By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,529 Members | 864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,529 IT Pros & Developers. It's quick & easy.

Excel file locked for editing

100+
P: 116
Hi,

I am making use of an Excel file in a form via the following process (edited for brevity).

Expand|Select|Wrap|Line Numbers
  1. Imports Excel = Microsoft.Office.Interop.Excel
  2. Imports Microsoft.Office
  3. xlApp = New Excel.Application
  4. xlApp = CreateObject("Excel.Application")
  5. xlWorkBook = xlApp.Workbooks.Open(....)
  6.  
When the form is disposed the following code should, I thought, release the file.

Expand|Select|Wrap|Line Numbers
  1. xlApp.Quit()
  2. releaseObject(xlApp)
  3. releaseObject(xlWorkBook)
  4.  
However when I try to open the xlsm file in MS Excel it tells me that it is locked and read-only.

Where am I going wrong with releasing the file when the form closes?

Thanks
Feb 20 '15 #1
Share this Question
Share on Google+
1 Reply


100+
P: 116
I've now added the following line to the closing process but still cant get access to the xlsm file after form closed.

Expand|Select|Wrap|Line Numbers
  1. If Not xlWorkBook Is Nothing Then xlWorkBook.Close()
  2.  
Feb 20 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.