Switch the active Window ...
I am running Excel 2003 under Windows Vista.
The following code successfully opens an existing .TXT file ...
[vba]Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Sub Open_Notepad_StartUp_File()
Dim dbRetValue As Double
Dim stNoteExe As String, stFileName As String
stNoteExe = "Notepad.exe"
stFileName = MyTeamTo
dbRetValue = Shell(stNoteExe & " " & stFileName) <-- This line opens a new window & I want this window to become Active ...
End Sub[/vba]
As highlighted in red, how do I make the new window the Active window, so that I can edit the text file ?!?