@ gavio. Does it give the time that regedit is actually open ? ie until you close it yourself ? Or does it just return the time taken for windows to launch regedit ? Not sure at this point if rengask wants the shelled programs actual running time.

Just in case.... There have been quite a few queries recently on waiting for shelled processes to finish before executing other code. Do a search and you'll get lots of hits.

More from MSDN:-
You must use several other Windows API functions to launch and wait for the program to be terminated. The ExecuteAndWait method, shown below, can address this problem quite nicely. All you have to do is provide the full pathname and its required arguments to this method. The application you have just launched will retain the focus until it is subsequently terminated.

Public Sub ExecuteAndWait(cmdline As String)
Dim NameOfProc As PROCESS_INFORMATION
Dim NameStart As STARTUPINFO
Dim X As Long
NameStart.cb = Len(NameStart)
X = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, NameStart, NameOfProc)
X = WaitForSingleObject(NameOfProc.hProcess, INFINITE)
X = CloseHandle(NameOfProc.hProcess)
End Sub

As you can see from the code above, the ExecuteAndWait method uses several functions—CreateProcessA, WaitForSingleObject, and CloseHandle. We have already seen that a Windows application program can be executed by calling the ShellExecute function. You can also use the CreateProcessA function to launch applications and to force that application to retain the focus until it is terminated.