Hi,
Have written two codes VBA excel 2010 for opening text file in notepad and
save the file.
Did some searching and all the examples shows opening text file in notepad and uses sendkeys to save file. Sendkeys is not working to save notepad file.
file gets opened in notepad, trouble is in saving. the code does not sendkeys to notepad to save file.
Just wanted VBA to open file in notepad and save the notepad file.
What is missing for me to save the notepad file ?
Thanks
Tech
Have written two codes VBA excel 2010 for opening text file in notepad and
save the file.
Did some searching and all the examples shows opening text file in notepad and uses sendkeys to save file. Sendkeys is not working to save notepad file.
file gets opened in notepad, trouble is in saving. the code does not sendkeys to notepad to save file.
Code:
[bold]code 1 [/bold]
Library: Windows Script Host Object model.
file connected to it is wshom.ocx
Dim WSHScript as WshShell
set WSHScript = new WSHShell
WSHScript.run "notepad.exe c:\test\Test1.txt"
' Tried below all option none are responding,
all responses goes to excel 2010
WSHScript.sendkeys (^s)
WSHScript.sendkeys (s)
WSHScript.sendkeys (^fs)
WSHScript.sendkeys (%fs)
Code:
[bold]code 2[/bold]
dim shlApp as string
shlApp = "notepad.exe c:\test\Test1.txt"
call shell(shlApp,vbMaximizedfocus)
' Tried below all option none are responding,
' all responses goes to excel 2010
sendkeys "^s"
sendkeys "%fs"
Code:
[bold]code 3 [/bold]
Even this is not saving file
open c:\test\Test1.txt for append as freefile
close freefile
Just wanted VBA to open file in notepad and save the notepad file.
What is missing for me to save the notepad file ?
Thanks
Tech