Using TransferSpreadsheet Macro to import a single sheet from exce

P

PerryK

I have an excel workbook with multiple sheets of data.

I am trying to use a TransferSpreadsheet Macro to import 2 individual sheets
to seperate tables in access. (I have a seperate Macro for each sheet)

What is the correct "format" to identify the individual sheet in the Path?

As an example the file path is:
C:\Documents and Settings\My Documents\Monthly reporting\Monthy Reports for
Access Import.xls

One of the sheets is labled "Financial Data" - How do I add this to the end
of the path so it imports this sheet?

The error I get is "not a valid path" if I try to add the sheet name to end
of the path



Thanks in advance,
Perry K
 
F

fredg

I have an excel workbook with multiple sheets of data.

I am trying to use a TransferSpreadsheet Macro to import 2 individual sheets
to seperate tables in access. (I have a seperate Macro for each sheet)

What is the correct "format" to identify the individual sheet in the Path?

As an example the file path is:
C:\Documents and Settings\My Documents\Monthly reporting\Monthy Reports for
Access Import.xls

One of the sheets is labled "Financial Data" - How do I add this to the end
of the path so it imports this sheet?

The error I get is "not a valid path" if I try to add the sheet name to end
of the path


Thanks in advance,
Perry K

Use the Range argument.
Did you not read VBA help on the TransferSpreadsheet method?

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9,
"MyTableName", "c:\FolderName\SpreadsheetName.xls", False, "Financial
Data!A3:A100"

The above will import Column A, rows 3 through 100.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top