I have some code that opens notepad and adds some text to some html files then saves and closes them.
But, I would like for this to run in the background/hidden and can't get it to address the notepad instance unles it is forground/activewindow.
I have this problem everytime I use "SendKeys" is there a way to SendKeys to hidden/minimized apps ??
I am intending to use this as a small part of a larger task and schedule it to run hourly and wouldn't want it to pop-up unexpectedly. Also, I find things run much slower if they have to run while displayed, this would hopefuly speed things up as well.
I have been searching high and low for good information on Notepad automation but am finding little if any that pertains.
Thanks
But, I would like for this to run in the background/hidden and can't get it to address the notepad instance unles it is forground/activewindow.
I have this problem everytime I use "SendKeys" is there a way to SendKeys to hidden/minimized apps ??
Code:
Sub AddHTML()
Dim MyText As String
Dim Filename As String
Dim i As Integer
Dim NtPad As Variant
For i = 6 To 18
'------------------------------------------
MyText = "<meta http-equiv=refresh content=""15"">"
Filename = "M:\Hpublic\WorkStatus\WorkcenterStatus" & i & ".htm"
'-------------------------------------------
NtPad = Shell("C:\Windows\NOTEPAD.EXE " & Filename, 1)
With NtPad
SendKeys MyText, True
SendKeys "{ENTER}", True
SendKeys "%FS", True ' File-Save
Application.Wait Now + TimeValue("00:00:01")
SendKeys "%{F4}", True
End With
Next i
End Sub
I have been searching high and low for good information on Notepad automation but am finding little if any that pertains.
Thanks