I have this code which opens a file in a maximized form with no problem, however I'd like to maximize an already open file without reopening it.
Private Const SW_MAXIMIZE As Long = 3
Private 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
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Sub maximizewindow()
Filename = FindWindow(vbNullString, "Untitled.txt - Notepad")
start_doc = ShellExecute(Filename, "open", "C:\Untitled.txt", 0, 0, SW_MAXIMIZE)
End Sub
Many Thanks
Bookmarks