TransferSpreadsheet not "releasing" the file

rglman

Registered User.
Local time
Yesterday, 22:51
Joined
Jul 11, 2005
Messages
30
Has anyone experienced this: I have a module that imports data from an Excel spreadsheet using "TransferSpreadsheet". The spreadsheet is one of many protected worksheets in a protected workbook. In order to use "TransferSpreadsheet" the file has to be open in Excel, or Access will throw a "Cannot Decrypt File - Error 3161". (The protection has to remain as the workbook/sheets have many complex formulas which link them.)

The import works just fine. The problem is after I complete the import, and close the Excel file, I get a message that pops up saying:

'MyFileName.xls' is now available for editing.
Choose Read-Write to open it for editing.​


Here's the code I use:

' Import the current template into the "tblImportStage" table. DoCmd.TransferSpreadsheet acImport, 8, "tblImportStage", "\\MyPath\MyFileName.xls", False, "Template!A3:P4507"​

It is followed by several DoCmd's to update some other tables:

DoCmd.OpenQuery "qryLoadDetail", acViewNormal, acEdit
DoCmd.Close acQuery, "qryLoadDetail"​

Any ideas what the problem might be? Or is there some vba command that can be added to disconnect/close the connection?

Thanks in advance!
 
did you ever figure this out, I am having the exact same problem....
 

Users who are viewing this thread

Back
Top Bottom