djsmarties
Board Regular
- Joined
- Sep 10, 2002
- Messages
- 95
Hi, I want to import a range in an excel worksheet into access.
In access i use the transferspreadsheet action to do this. With a range defined as i.e. a1:c3 it works fine, but when i use a range name it doesn't work and i get an error message "can't find object..."
here is the code i use:
DoCmd.TransferSpreadsheet acImport, 8, "product_detail", "p:/project/country_input_template.xls", True, "product_detail"
The range in excel are columns. the reason i use a range name is because i don't import every column, for example i would not want to import colums c, f, and i. "product_detail" is the name of the range.
What's wrong with the code? I can't get it to work, i tried a lot of different things, but i always get the same error message.
Maybe it works better if i try to export from excel instead of importing using access code?
Thanks for your help.
In access i use the transferspreadsheet action to do this. With a range defined as i.e. a1:c3 it works fine, but when i use a range name it doesn't work and i get an error message "can't find object..."
here is the code i use:
DoCmd.TransferSpreadsheet acImport, 8, "product_detail", "p:/project/country_input_template.xls", True, "product_detail"
The range in excel are columns. the reason i use a range name is because i don't import every column, for example i would not want to import colums c, f, and i. "product_detail" is the name of the range.
What's wrong with the code? I can't get it to work, i tried a lot of different things, but i always get the same error message.
Maybe it works better if i try to export from excel instead of importing using access code?
Thanks for your help.