"Jack" <replyto@it wrote in message
...
Follow up.
The same happens when stepping through this code:
On Error Resume Next 'TEMPORARILY ignore errors
Set moExcelApp = GetObject(, "Excel.Application")
If moExcelApp Is Nothing Then
Set moExcelApp = CreateObject("Excel.Application") === after
executing that line the code will not stop at the next line (End If)
End If
Interestingly, I am using the same code in another of my app and it does
work fine on the same computer!!!!
The Reference is set exactly to the same file and the general settings are
the same:
Option Explicit
Public WithEvents moExcelApp As Excel.Application
Dim moExcelWBk As Excel.Workbook
Dim moExcelWS As Excel.Worksheet
Jack
Take a good look at Dave's advice.
In a nutshell: Excel is a PITA if you have more than one running.
(GetObject) Fully qualify ALL objects with the object reference. Make sure
you have cleaned up everything. Explicitly tell it whether you want to save
or not. Explicitly call .Exit. While debugging make sure DisplayAlerts is on
and when you are no longer debugging make sure they are off.
Here's is a slew of tips:
Note the suggestion to turn .DisplayAlerts back on when you Exit.
http://www.tek-tips.com/viewthread.cfm?qid=90756&page=1
hth
-ralph