On 2002-02-27 13:04, ]-[ /-\ \/\/ /-\ | | /-\ |\| wrote:
I have an Excel workbook (that has worked normally) that kept crashing on me, closing the program. I figured out the problem: there was a running instance of Excel in the background which was causing this particular workbook to get a housecall from Dr Watson(checked task manager/processes tab and tested theory). I would like to add some vba code to the workbook_open event of this workbook to check if there is a running instance of Excel and to terminate it to prevent this "bug" from coming back. There is a way I have seen, but I don't recall how it's done. Can anyone help me? Much Mahalo!
Aloha!
*(Excel2k/WinNT4 sp6)
Copy this code to notepad. save the file as XLfinder.vbs
when run it will find any instance of xl that is currently active even if hidden.
I keep mine on the desktop so I dont have to go looking for it.
Dim objXL
Dim strMessage
On Error Resume Next
' Try to grab a running instance of
' Excel...
Set objXL = GetObject(, "Excel.Application")
' What did we find?..
If Not TypeName(objXL) = "Empty" Then
strMessage = "Excel Running."
Else
strMessage = "Excel Not Running."
End If
' Feedback to user...
MsgBox strMessage, vbInformation, "Excel Status"
' Make the Excel instance visible
' if we found one
if strMessage = "Excel Running." then _
objXL.Visible = true
PS Moving to the Big Island in two years see you there.
Visiting for a month this November!!
Aloha
This message was edited by KniteMare on 2002-03-05 13:34
This message was edited by KniteMare on 2002-03-05 13:40