+ Reply to Thread
Results 1 to 3 of 3

Re: Runnig Excel without visible application

  1. #1
    keavenmj@yahoo.com
    Guest

    Re: 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. #2
    Fredrik Wahlgren
    Guest

    Re: Runnig Excel without visible application


    <keavenmj@yahoo.com> wrote in message
    news:1111782415.872732.175920@z14g2000cwz.googlegroups.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. #3
    Bob Phillips
    Guest

    Re: 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)


    <keavenmj@yahoo.com> wrote in message
    news:1111782415.872732.175920@z14g2000cwz.googlegroups.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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1