|
-
Jan 6th, 2006, 09:34 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Obtaining the process ID, VbScript
Hi guys,
I need to get the process ID of the Excel Application that I just lunched with VbScript. I need it for security reason, in case the macro failed, Excel process is still running. I'm running this script on SQL Server, in a DTS Package. So if the macro fail, another script will terminate the Excel Process.
I am able to kill all Excel process at once, but I need to only kill the Excel process where the macro failed
Here is the code:
Function Main()
Dim Excel_Application
Set Excel_Application = CreateObject("Excel.Application")
/////Need to get the process ID right Here
Excel_Application.Workbooks.Open("c:\que.xls")
Excel_Application.Run ("Main") 'Name of the macro to run
Excel_Application.DisplayAlerts=False
Excel_Application.Quit
Set Excel_Application = Nothing
Main = DTSTaskExecResult_Success
End Function
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|