Re: Checking whether Excel is already open
- From: "Dave Patrick" <DSPatrick@xxxxxxxxxxxxxxxx>
- Date: Sun, 18 Feb 2007 07:38:41 -0700
Here's what I do.
If IsExecuting("excel.exe") = True Then
Set oExcel = GetObject(, "Excel.Application")
Else
Set oExcel = CreateObject("Excel.Application")
End If
Public Function IsExecuting(sProc)
Dim list As Object
Set list = GetObject("winmgmts:").ExecQuery( _
"select * from win32_process where name='" & sProc & "'")
If list.Count > 0 Then IsExecuting = True
End Function
--
Regards,
Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
"10_a_c" wrote:
Hello:
I have a VB form which will load Excel but I want to add code which will
first check to see whether Excel is already open and then branch accordingly.
I assumed that Excel.Visible = True would take care of that but it is not
working.
Let me thank you in advance for any and all suggestions.
.
- Prev by Date: Convert please
- Next by Date: Re: How to skip opening an already open file
- Previous by thread: Convert please
- Next by thread: OLEDB to pull alist from AS2005
- Index(es):
Relevant Pages
|