Results 1 to 2 of 2
  1. #1
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Frederick, Maryland, USA
    Thanked 2 Times in 2 Posts

    Application wont release (Excel 2k Sr1)

    I am using access to send data to excel and then modify the data as needed. This works fine. However, when the processing is done in excel, code saves the file and then sets the workbook to nothing and exits the application (at least its supposed to). Excel is closed but doesn't release such that if you try to open another file or run the process again to save the same file, Excel locks or states the file is in use. Code related to working with excel from access is as follows:


    Dim xlapp As Excel.Application
    Dim xlwbk As Excel.Workbook
    Dim xlsht As Excel.Worksheet
    Dim sheet As Object

    'Open Application / Workbook
    Set xlapp = CreateObject("Excel.Application")
    Set xlwbk = xlapp.Workbooks.Open(Filename:=strName)

    xlwbk.Close SaveChanges:=True
    Set xlsht = Nothing
    Set xlwbk = Nothing
    Set xlapp = Nothing

    'Then returns back to MS Access

    Any ideas or suggestions on why this is happening?

    (It's been a while!)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Application wont release (Excel 2k Sr1)

    Have you checked in the Processes tab of the Task Manager that Excel.exe is not active any more? (It's not sufficient to check in the Programs tab)

    Make sure that each and every reference to something in Excel is prefixed by one of the Excel objects xlApp, xlWbk, xlSht or sheet.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts