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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running program with Parameters

Status
Not open for further replies.

McGoat

MIS
Jun 7, 2001
11
0
0
DK
Is there a VBscript to run a program i.e.: C:\program files\office\winword.exe c:\docs\users.doc ??
So I can open a word document with word...

Please help...
 
FWIW, I'd just execute the document and let the windows shell open it in whatever viewer the user has specified for .DOC files:

Set oShell = CreateObject("WScript.Shell")
sDoc= chr(34) & "C:\path\to\your.doc" & chr(34)
oShell.Run sDoc,1,False

If you want to force it to be opened in Word, try:

Set oShell = CreateObject("WScript.Shell")
sDoc= chr(34) & "C:\path\to\your.doc" & chr(34)

Set oWord = CreateObject("Word.Application")
sPath = chr(34) & oWord.Path & "\winword.exe" & chr(34)

oWord.Quit
Set oWord = Nothing

oShell.Run sPath & sDoc,1,False Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top