Option Explicit
Dim RetVal As Double 'Must be double, or Error will occur Private Sub Command1_Click() RetVal = Shell("C:\program files\internet explorer\IEXPLORE.exe") 'In theory, ANY path could be entered here End Sub Private Sub Command2_Click() AppActivate RetVal 'This will give focus to the program started with the 'Shell() function. End Sub Assumes: Retval = Shell ("C:\Program Files\Internet Explorer\IEXPLORE.exe") will return the Task ID into RetVal Also, you need two command buttons For this code to work. Side Effects: You SHOULD start up the program yourself. You cannot use this code if you do not have the task ID, otherwise it will not work. |