Transfer multiple tables to different tabs in 1 Excel document

D

Dean Knox

Hi,

I am using the transfer text ac export procedure to export a table to excel.

My question is:

Is there anyway to export 3 Access tables into 3 different tabs on an excel
workbook using vba?

Thanks in advance

Dean
 
N

Nikos Yannacopoulos

Dean,

Use TransferSpreadsheet instead. One of its arguments is Range, use it
to specify the sheet name, just don't use any "funny" characters in it.
If the sheet does not exist it will be created, if it does it will be
overwritten.

Note: if you look it up in help, it says:

Range Optional Variant. A string expression that's a valid range of
cells or the name of a range in the spreadsheet. This argument applies
only to importing. Leave this argument blank to import the entire
spreadsheet. When you export to a spreadsheet, you must leave this
argument blank. If you enter a range, the export will fail.

Well, guess what, it works! Not sure why it's undocumented by Microsoft,
much more why they would say it will fail.

HTH,
Nikos
 
Top