Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Runnig Excel without visible application
This was just the thing i've been looking for... but it dosn't work :(
I get a message box that pops up and tells me "Excel Running" .. and then nothing happens. I tried moving the "objXL.Visible = true" statement inside the first If-Else, and that didn't work eaither. <grumble i have a crashed version of excel sitting in my background somewhere that i need to get to. Jon Peltier wrote: But you can get at that invisible Excel instance in a couple ways. Ctrl-Alt-Del will give you the list of running apps, but you can only kill it from here. The other way was posted by Rob Bruce some time back. Put this code into a text file: ' === Begin script =============== ' from Rob Bruce Dim objXL, strMessage On Error Resume Next Set objXL = GetObject(, "Excel.Application") If Not TypeName(objXL) = "Empty" Then strMessage = "Excel Running." Else strMessage = "Excel Not Running." End If MsgBox strMessage, vbInformation, "Excel Status" if strMessage = "Excel Running." then objXL.Visible = true ' === End script =============== Save it with a name like "XLcheck.vbs". If you have a hidden Excel instance, running this script will bring it up front. If there is no such hidden instance, it tells you that, too. - Jon |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Runnig Excel without visible application
wrote in message oups.com... This was just the thing i've been looking for... but it dosn't work :( I get a message box that pops up and tells me "Excel Running" .. and then nothing happens. I tried moving the "objXL.Visible = true" statement inside the first If-Else, and that didn't work eaither. <grumble i have a crashed version of excel sitting in my background somewhere that i need to get to. Jon Peltier wrote: But you can get at that invisible Excel instance in a couple ways. Ctrl-Alt-Del will give you the list of running apps, but you can only kill it from here. The other way was posted by Rob Bruce some time back. Put this code into a text file: ' === Begin script =============== ' from Rob Bruce Dim objXL, strMessage On Error Resume Next Set objXL = GetObject(, "Excel.Application") If Not TypeName(objXL) = "Empty" Then strMessage = "Excel Running." Else strMessage = "Excel Not Running." End If MsgBox strMessage, vbInformation, "Excel Status" if strMessage = "Excel Running." then objXL.Visible = true ' === End script =============== Save it with a name like "XLcheck.vbs". If you have a hidden Excel instance, running this script will bring it up front. If there is no such hidden instance, it tells you that, too. - Jon I don't think the code will work. The problem is that not all versions of Excel register themselves in the Running Object Table. If a running application isn't registered there, GetObject will return NULL. The Soution to this problem is to get a handle to the main Excel window, called "XLMAIN" and send the message WM_USER + 18 to it. You can find more information here http://support.microsoft.com/default...b;EN-US;138723 I also think that the line If Not TypeName(objXL) = "Empty" Then should be changed to If Not objXL is Nothing Then This is easier to understand. /Fredrik |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Runnig Excel without visible application
You did put it in a vbs file, not in VBA didn't you?
-- HTH RP (remove nothere from the email address if mailing direct) wrote in message oups.com... This was just the thing i've been looking for... but it dosn't work :( I get a message box that pops up and tells me "Excel Running" .. and then nothing happens. I tried moving the "objXL.Visible = true" statement inside the first If-Else, and that didn't work eaither. <grumble i have a crashed version of excel sitting in my background somewhere that i need to get to. Jon Peltier wrote: But you can get at that invisible Excel instance in a couple ways. Ctrl-Alt-Del will give you the list of running apps, but you can only kill it from here. The other way was posted by Rob Bruce some time back. Put this code into a text file: ' === Begin script =============== ' from Rob Bruce Dim objXL, strMessage On Error Resume Next Set objXL = GetObject(, "Excel.Application") If Not TypeName(objXL) = "Empty" Then strMessage = "Excel Running." Else strMessage = "Excel Not Running." End If MsgBox strMessage, vbInformation, "Excel Status" if strMessage = "Excel Running." then objXL.Visible = true ' === End script =============== Save it with a name like "XLcheck.vbs". If you have a hidden Excel instance, running this script will bring it up front. If there is no such hidden instance, it tells you that, too. - Jon |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Application.Visible = False | Setting up and Configuration of Excel | |||
Application.Visible = False | Excel Discussion (Misc queries) | |||
Application.visible help | Excel Programming | |||
Linked Excel Chart within hidden Word Application Visible | Excel Programming | |||
Runnig a macro when excel opens | Excel Programming |