vba - Error when importing an Excel worksheet into Access table -


i getting error run-time error 3125 'import$' not valid name. make sure not include invalid characters or punctuation , not long when attempting import excel file access table. only receive error when other excel files open otherwise excel file loaded table expected. here of code working with:

dim f filedialog, str string set f = application.filedialog(msofiledialogfilepicker) f.show on error goto err1 str = f.selecteditems(1)  dim xl excel.application set xl = new excel.application xl.visible = true  dim xlwb excel.workbook set xlwb = xl.workbooks.open(str)  'manipulate excel file  'load spreadsheet on error goto err2 docmd.transferspreadsheet acimport, 8, "jobcode", str, true, "import!" 

i thought , tried change filename, unsuccessful. seems code opening new version of import excel file read-only might confusing access database on worksheet import. not sure why it's doing , why when excel file open. problem? know how fix this?

thank you!


Comments