Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I start Notepad?

Status
Not open for further replies.

riccy

Programmer
Oct 30, 2001
4
DE
Hello,

if I want to launch Word I have to write

Set Application=CreateObject("Word.Application")

What a object do I have to create whether I want to start Notepad? Thanx a lot...
 
From the WSH 5.6 Help file:

The following VBScript code opens a copy of the currently running script with Notepad.

Code:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\notepad " & WScript.ScriptFullName

The following VBScript code does the same thing, except it specifies the window type, waits for Notepad to be shut down by the user, and saves the error code returned from Notepad when it is shut down.

Code:
Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("notepad " & WScript.ScriptFullName, 1, true)

Aside from this there isn't a lot you can do as far as I know. Notepad isn't a COM server of any sort and doesn't expose an automation interface the way Office programs do.

Maybe this is enough?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top