Hi,
I'm new to VbScript, and am playing around with a little script that will check to see if Excel is open, if so, go to that instance, otherwise startup a new one.
The code I have works, but if I detect an existing Excel application, I can't get it to "task-switch" to it; it just makes the taskbar icon for Excel, flash.
I was able to make it work by creating a WScript.Shell object, and doing an "AppActivate", but I thought I should be able to do it using the existing excel object ("objExcel").
Here is my code ... any help is appreciated.
Dim NewObj
NewObj = false
on error resume next
set objExcel = GetObject(, "Excel.Application")
If objExcel is nothing Then
set objExcel = CreateObject("Excel.Application")
NewObj = true
End If
objExcel.Visible = True
if NewObj = true then
objExcel.Workbooks.Add
end if
I'm new to VbScript, and am playing around with a little script that will check to see if Excel is open, if so, go to that instance, otherwise startup a new one.
The code I have works, but if I detect an existing Excel application, I can't get it to "task-switch" to it; it just makes the taskbar icon for Excel, flash.
I was able to make it work by creating a WScript.Shell object, and doing an "AppActivate", but I thought I should be able to do it using the existing excel object ("objExcel").
Here is my code ... any help is appreciated.
Dim NewObj
NewObj = false
on error resume next
set objExcel = GetObject(, "Excel.Application")
If objExcel is nothing Then
set objExcel = CreateObject("Excel.Application")
NewObj = true
End If
objExcel.Visible = True
if NewObj = true then
objExcel.Workbooks.Add
end if