Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
hbj hbj is offline
external usenet poster
 
Posts: 35
Default Retrieving records from closed Excel workbook

I need a simple way of retrieving records from a worksheet - with headers - in a closed Excel workbook using SQL. But I also want VBA to detect the Excel version and establish the proper connection (2007 and later).

HÃ¥kan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,182
Default Retrieving records from closed Excel workbook

I need a simple way of retrieving records from a worksheet - with headers -
in a closed Excel workbook using SQL. But I also want VBA to detect the Excel
version and establish the proper connection (2007 and later).

Håkan


This would use ADODB and it doesn't matter which provider you use because both
VBA6/VBA7 support the JET/ACE engines.

FYI:
VBA7 is used in Excel 2010 and later;
VBA6 is used in Excel 2007 and earlier;

Here's a good primer on how to get started using ADODB with Excel files...

http://www.appspro.com/conference/Da...rogramming.zip

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Retrieving records from closed Excel workbook

"GS" wrote in message

This would use ADODB and it doesn't matter which provider you use because
both VBA6/VBA7 support the JET/ACE engines.

FYI:
VBA7 is used in Excel 2010 and later;
VBA6 is used in Excel 2007 and earlier;


Just to add, although VBA6 / VBA7 is not related to this, unless need to
support 2003 for later versions probably better to use the ACE engine which
is normally available in all 32/64 bit systems, unlike JET which is less
likely to be particularly x64.

If in doubt use something like

If Val(Application.Version) <= 11 Then ' 2003 or earlier
sPovider = "Provider=Microsoft.Jet.OLEDB.4.0;"
Else
sPovider = "Provider=Microsoft.ACE.OLEDB.12.0;"
End If


Peter T



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,182
Default Retrieving records from closed Excel workbook

"GS" wrote in message

This would use ADODB and it doesn't matter which provider you use because
both VBA6/VBA7 support the JET/ACE engines.

FYI:
VBA7 is used in Excel 2010 and later;
VBA6 is used in Excel 2007 and earlier;


Just to add, although VBA6 / VBA7 is not related to this, unless need to
support 2003 for later versions probably better to use the ACE engine which
is normally available in all 32/64 bit systems, unlike JET which is less
likely to be particularly x64.

If in doubt use something like

If Val(Application.Version) <= 11 Then ' 2003 or earlier
sPovider = "Provider=Microsoft.Jet.OLEDB.4.0;"
Else
sPovider = "Provider=Microsoft.ACE.OLEDB.12.0;"
End If


Peter T


Yes, that's how I have my wrapper coded. This is outlined in Rob's doc that
accompanies the samples in the link I provided.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retreiving records from closed workbook Håkan Björkström Excel Worksheet Functions 0 February 20th 17 03:49 PM
Macro for Retrieving data from closed workbook with date in title DavidH56 Excel Programming 2 April 14th 08 10:24 PM
Error retrieving data from closed workbook Add Excel Programming 4 December 26th 07 04:59 AM
Retrieving cell formatting from closed workbook paulharvey Excel Programming 1 July 15th 05 02:55 PM
Retrieving cell formatting from closed workbook Paul Harvey Excel Programming 0 July 14th 05 09:48 PM


All times are GMT +1. The time now is 07:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"