Object Required Error

G

Guest

I thought it would be cleaner and easier to declare the import file path and
then use it in TransferSpreadsheet as shown below. The DoCmd will be
repeated many times - the only thing changing will be the file name.

I'm getting an "object required" error - help?


Dim FilePath As String
Set FilePath = "\\oprdgv1\depart\Finance\_Budget\2007\ePlanning Loads\2007
2007 Forecasts\"

'Import Current Year (CY) data from Excel
DoCmd.TransferSpreadsheet acImport, 8, FilePath &
"CTS_700_HPP_Eplanning_Load.xls", True, _
"Financial_BU1!E6:Z20000"
 
D

Douglas J. Steele

You're missing the name of the table: it goes after the 8, before the path
to the spreadsheet.

BTW, you don't need the Set keyword when you're setting variables.
 
G

Guest

Thanks for the help!!

Douglas J. Steele said:
You're missing the name of the table: it goes after the 8, before the path
to the spreadsheet.

BTW, you don't need the Set keyword when you're setting variables.
 

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