View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick S. Rick S. is offline
external usenet poster
 
Posts: 213
Default Determine instances of Excel open

Funny, I am trying to force a second instance but found how to count
instances open. The authors name is Jennifer
'======
Sub ExcelInstances() 'Office discussion Groups author: Jennifer
Dim XLCount
Dim oWMI

Set oWMI = GetObject("winmgmts:")
XLCount = 0

For Each Process In oWMI.InstancesOf("Win32_Process")
If UCase(Process.Name) = "EXCEL.EXE" Then
XLCount = XLCount + 1
End If
Next

MsgBox "Excel Instances Open: " & XLCount

Set oWMI = Nothing

End Sub
'======
--
Regards

XP Pro
Office 2007