Problem when reading closing Outlook form that uses Excel sheet

A

adammfellows

Hi

I have written a custom Outlook form that opens an Excel file and reads
in data to be used in various combo box lists.

The item_close() function closes down the Excel workbook again.
Unfortunately if the user has another Excel workbook open at the time
and is in the middle of inputting to a cell, an error is generated. If
the user is not in the middle of input it works fine, even if the other
workbook has outstanding changes to be saved. Only the Excel sheet
containing the combo box data is closed, as is correct.

Does anyone know a way around this?

Thanks

For reference, the code is as follows:

Function Item_Open()

set ins = item.getinspector

set cts = ins.modifiedformpages("Message").controls
set xls =
GetObject("\\uknpt003\Departments\CentralProcurement\ProcurementFormData.xls")
..
..
..
End sub
..
..
Function Item_Close()
xls.close
"\\uknpt003\Departments\CentralProcurement\ProcurementFormData.xls"
set xls = nothing
set cts = nothing
set ins = nothing
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top