![]() |
|
#1
|
|||
|
|||
|
Hi guys....
I am using the following code to check if Excel is currently active on a User's PC prior to opening another Excel Workbook. Code:
'In a "Globals" module"
Public gxlApp As Excel.Application
Public gbooExcelIsRunning As Boolean
'In the "detection" module
On Error Resume Next
Set gxlApp = GetObject(, "Excel.Application")
If Err.Number <> 0 Then
gbooExcelIsRunning = False
Set gxlApp = New Excel.Application
Else
gbooExcelIsRunning = True
End If
On Error GoTo 0
It appears that my code actually invokes Excel (via the GetObject process??). Can any kind soul correct my code to DETECT Excel, rather than INVOKE Excel? I know the end result is to create an instance of Excel (which this does), but I'm trying to ensure that, later on in the code, if Excel was running to just close the new Workbook, but if Excel wasn't running, I'd like to close the Workbook and shut Excel down. |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem copying active excel table onto word, office 2013 | billb | Word | 2 | 01-08-2014 05:12 PM |
Word vs bookmarks, another instance <g>
|
eNGiNe | Word | 6 | 12-05-2012 01:05 AM |
www....com does not stay active in excel 2010
|
waltdisneypixar | Excel | 6 | 06-11-2012 12:55 AM |
How to create multiple pages, 1 instance of word window
|
cs_starter | Mail Merge | 1 | 09-08-2011 12:52 AM |
VB Code in Excel Active worksheet
|
shakilhyd | Excel | 2 | 05-17-2010 07:50 AM |