Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
If Process Exists then
I need the Excel VBA equivalent code for "If Process exists then....endif".
Thank you. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
If Process Exists then
What do you mean by "Process"
Regards, Peter T "thomas" wrote in message ... I need the Excel VBA equivalent code for "If Process exists then....endif". Thank you. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
If Process Exists then
You'll need to work through additional details but I would start by making
psapi.dll function EnumProcesses available by using a Declare statement. The remaining steps depend on exactly what you are looking for, "thomas" wrote in message ... I need the Excel VBA equivalent code for "If Process exists then....endif". Thank you. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
If Process Exists then
I need the Excel VBA equivalent code for "If Process exists then....endif". By "process" do you mean a Windows process? Or something else? I think you need to clarify exactly what you want to test for. For a Windows process whose Process ID is known, use code similar to the following: '''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''' Private Declare Function GetProcessVersion Lib "kernel32" ( _ ByVal ProcessID As Long) As Long Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long Sub AAA() Dim ProcID As Long Dim Version As Long Dim LastErr As Long Dim ThisProcID As Long ThisProcID = GetCurrentProcessId() ProcID = 1234& ' specify process ID ' OR ProcID = ThisProcID ' this process ID Version = GetProcessVersion(ProcID) LastErr = Err.LastDllError If Version = 0 Then If LastErr = &H57 Then ' processs does not exist Debug.Print "Process does not exist" Else ' process exists but access is denied Debug.Print "Err: " & CStr(LastErr), _ GetSystemErrorMessageText(LastErr) End If Else ' process exists and is accessible: Debug.Print "Process Exists. Version: " & Hex(Version) End If End Sub '''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''' Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Mon, 13 Oct 2008 23:04:01 -0700, thomas wrote: I need the Excel VBA equivalent code for "If Process exists then....endif". Thank you. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
If Process Exists then
Windows process is what I mean and Chip, your code saves the day for me.
Thank you all, gentlemen. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need to process first row. | Excel Programming | |||
If/then Process? | Excel Discussion (Misc queries) | |||
How to count process running time ( process not finished) | Excel Programming | |||
How to count process running time ( process not finished) | Excel Programming | |||
step into process | Excel Programming |