Excel file locked for editing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • robertybob
    New Member
    • Feb 2013
    • 116

    Excel file locked for editing

    Hi,

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

    Code:
    Imports Excel = Microsoft.Office.Interop.Excel
    Imports Microsoft.Office
    xlApp = New Excel.Application
    xlApp = CreateObject("Excel.Application")
    xlWorkBook = xlApp.Workbooks.Open(....)
    When the form is disposed the following code should, I thought, release the file.

    Code:
    xlApp.Quit()
    releaseObject(xlApp)
    releaseObject(xlWorkBook)
    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
  • robertybob
    New Member
    • Feb 2013
    • 116

    #2
    I've now added the following line to the closing process but still cant get access to the xlsm file after form closed.

    Code:
    If Not xlWorkBook Is Nothing Then xlWorkBook.Close()

    Comment

    Working...