ProgramError
Programmer
I'm using the following code to open an Excel sheet to import the data but I'm not sure how to check if the a workbook is already open before going ahead and opening it.
I could close the workbook after each call to the routine but I want to leave it open so the user can check the data imported for any inconsistencies.
Thanks
Ian Mayor (UK)
Program Error
Always make your words sweet and nice. Because you never know when you may have to eat them.
I could close the workbook after each call to the routine but I want to leave it open so the user can check the data imported for any inconsistencies.
Code:
Dim XLS As Object
'check if xl sheet is already open, skip next step if so
'open
Set XLS = CreateObject("EXCEL.APPLICATION")
XLS.Application.Visible = True
XLS.Application.WORKBOOKS.Open "C:\Documents and Settings\Administrator\Desktop\advocacytemp.xls"
'continues with import routine
Ian Mayor (UK)
Program Error
Always make your words sweet and nice. Because you never know when you may have to eat them.