I have been running an access Database in Office 2003 for a while now. When I upgraded to Office 2007 one of my macro buttons has stopped working.
The Button looks up to VBA code to Import a specific Excel spread sheet from a specific location on my hard drive. This file is updated but never re-named or moved so to save time I have created the import macro to do the import steps for me.
This has been working fine for me in Office 2003. Once I upgraded to Office 2007 this has stopped working.
the code that I have been using is as follows:
Expand|Select|Wrap|Line Numbers
- Private Sub Import_PBs_Click()
- DoCmd.TransferSpreadsheet acImport, 0, _
- "z new pbs", "....\new pbscrs\newpbs.xls", True
- End Sub
I have found that Office 2007 uses code starting: "DoCmd.RunCommand acCmdImportAttachExcel"
however I cannot seem to get this to automatically import the excel sheet, instead it opens the import wizard.
I have the imports saved in the "saved imports" wizard but i want to be able to run this from a macro button.
anyone have any suggestions?