Feb 19, 2002 #1 McGoat MIS Jun 7, 2001 11 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...
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...
Feb 21, 2002 #2 jonscott8 Programmer May 12, 2000 1,317 US 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 Upvote 0 Downvote
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