How to unhide hidden Excel Instance

  • Thread starter Missing Excel Debug
  • Start date
M

Missing Excel Debug

Our main application uses Excel via automation to produce financial reports.
Up until recently we could always debug this process by dropping a STOP
command within the code module for the Excel Addin. Somehow with a recent
update the vendor has changed the way their product calls Excel via
automation so that even a STOP command followed by by a line setting the
Visible property to TRUE will not stop Excel.

Any way to grab a hold of or hook into Excel when this happens? We've had
some dooseys (problems) before that in the past we've found it much easier
and faster to fix ourselves but we have to be able to see what line of code
in the add-in that Excel is hanging up on as well as various varable values
and we can't now.

Thanks
 
J

joel

The simple way is to go to task manager and get the process Id by look for
the process excel.exe. then use AppActivate.

Look at VBA help for the following:

AppActivate Statement

If you need it automated there is a method to get the process ID by look for
the process excel.exe. I don't heve that method handy at the moment.
 
D

Dave Peterson

I have a shortcut to a .vbs file on my desktop. It unhides excel, word, ppt,
access.

But I have to close the visible instances of each program first. Then unhide
and close that instance. And repeat the unhide, close, unhide, close, ... until
there's nothing left to unhide.

If you want, here's the text of the .VBS file:

dim myXL
On Error Resume Next
Set myXL = GetObject(, "Excel.Application")
If Err.Number = 429 Then
msgbox "Excel is not running"
else
myxl.visible = true
end If
On Error GoTo 0
Set myxl = nothing

dim myWord
On Error Resume Next
Set myWord = GetObject(, "Word.Application")
If Err.Number = 429 Then
msgbox "Word is not running"
else
myWord.visible = true
end If
On Error GoTo 0
Set myWord = nothing

dim myOutlook
On Error Resume Next
Set myOutlook = GetObject(, "outlook.Application")
If Err.Number = 429 Then
msgbox "Outlook is not running"
else
myOutlook.visible = true
end If
On Error GoTo 0
Set myOutlook = nothing

dim myPPT
On Error Resume Next
Set myPPT = GetObject(, "Powerpoint.Application")
If Err.Number = 429 Then
msgbox "Power Point is not running"
else
myPPT.visible = true
end If
On Error GoTo 0
Set myPPT = nothing

dim myAcc
On Error Resume Next
Set myPPT = GetObject(, "Access.Application")
If Err.Number = 429 Then
msgbox "Access is not running"
else
myAcc.visible = true
end If
On Error GoTo 0
Set myAcc = nothing

=============================
You could actually have 4 different .vbs files -- each to unhide a single
application. But that's too much clutter for me.

Just copy the text (or as much as you want) into a notepad. Save that file as a
..vbs and then create a shortcut on your desktop to the .vbs file.

(I'd rather keep the .vbs file save in a nice folder. Then if I screw up, I can
just recreate a shortcut instead of trying to remember what the .vbs script
actually looked like.)
 

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