Open and Write to Notepad from excel VBA

David picture David · Jul 1, 2015 · Viewed 17.1k times · Source

I need to open notepad and write my results from my macro to it. I want to open notepad and write to it, and have the user review and if he or she wants to save it then save it wherever they like. Instead of writing to it and saving on the computer all in the code.

Thanks

Answer

Tarik picture Tarik · Jul 1, 2015

Use the following code to open notepad and type into it:

Dim myApp As String
myApp = Shell("Notepad",    vbNormalFocus)
SendKeys "test", True