What's wrong with the transferspreasheet code?

msand

Board Regular
Joined
Apr 15, 2003
Messages
74
I am doing datatransfer from excel to access. In the spreasheet code line, I want to use active workbook name but it kept showing this is wrong. The latest running showed "Run-time Error 13" -Type Mismatch.
anybody knows what's wrong with the line code of ActiveWorkbook?
Thanks


appAccess.DoCmd.TransferSpreadsheet _
acImport, _
acSpreadsheetTypeExcel97, _
"Shipping", _
"ActiveWorkbook.Path &" \ " & ActiveWorkbook.Name", _
True, "TransferRange"
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I figured it out by using MsgBox to test. Here is the code that works.


appAccess.DoCmd.TransferSpreadsheet _
acImport, _
acSpreadsheetTypeExcel97, _
"Shipping", _
ActiveWorkbook.Name, _
True, "TransferRange"

Hey thanks people who help on the thread "how to automate data import process from Excel to Access"

msand
 
Upvote 0

Forum statistics

Threads
1,221,528
Messages
6,160,343
Members
451,638
Latest member
MyFlower

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top