I would like to be able to use VB 2003 .NET to check if Excel is
running, and if it is, then do something with the active workbook.
I can see if Excel is running:
Private Sub GetAllExcelApps()
Dim AllExeclProcesses() As Process
Dim OneExcelProcess As Process
Dim OneExcelApp As Excel.Application
' get all open instances of excel
AllExeclProcesses = Process.GetProcessesByName("EXCEL")
' Iterate through the process array.
For Each OneExcelProcess In AllExeclProcesses
' do something
Next
End Sub
But how do I convert OneExcelProcess into OneExcelApp? I can create an
Excel Application instance:
Private Sub MyExcelProcess()
Dim MyExcelApp As Excel.Application = New Excel.Application
' do somthing
MyExcelApp.Quit()
MyExcelApp = Nothing
End Sub
But I do not want a new Excel application. I want to be able to do
something only is Excel is already running.
Thanks