Hi

I am trying to write some VBA code in Excel to Open a .dat file in Notepad, save the file and close Notepad. I've managed to open the notepad file using a filename stored in cell A1 (as the name changes daily) but I can't work out how to save the notepad file and close notepad.

Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpszClass As String, ByVal lpszTitle As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Form_Load2()
Dim dTaskID As Double, path As String, file As String
Dim hwndNotepad As Long
Dim hwndTextbox As Long
Dim MyName
MyName = Range("A1")
path = "C:\WINDOWS\notepad.exe"
file = "J:\JUTEST\" & MyName
dTaskID = Shell(path + " " + file, vbNormalFocus)
hwndNotepad = FindWindowEx(0, 0, "Notepad", vbNullString)
???????????? - Code to save and close file
Windows("BSconvert.xls").Activate
    Sheets("Files").Select
    Rows("1:1").Select
    Selection.Delete Shift:=xlToUp
ActiveWorkbook.Save
End Sub
Can anyone help me please?

Thanks in advance

Jules