• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

Excel File Locks

I developed an application in Access that also ties into Excel, my Access app gets data from Excel and updates 12 tables, then allows the user to select a date range and it dumps out to 12 excel files, refreshes excel and the excel app then has 12 data connections to those files for doing graphs etc.   I open both Excel and Access and run the access vb and it all works fine but if I rerun it a second time it fails on the export to excel and it says the files are open by another application....So I guess the excel files get locked by excel when I refresh the data link, is there a way to temporarily break that link (lock) so I can update those excel files?
1 Solution
You need to ensure in your code that all instances of excel that are opened are killed and all workbooks that were opened are also killed something like

Dim oApp as Excel.Application
Dim wb as workbook
your code

.. before closing
Set wb = Nothing
Set oApp = Nothing


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now