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!

Using Shell to open Word

Status
Not open for further replies.

cammi

Programmer
May 3, 2001
13
US
I have a VB app with a button that is to perform some tasks, one of them being to open a word document that has been saved on a server share.

This executable is run off of the server.

The problem is that the path to the word executable doesn't seem to work for the client machine if I use the long file name. If I shorten to 8.3 file name, then I am taking a chance that the user has Word installed to the specific directory I have coded. I thought that maybe I could removed the path statement to word from my Shell command, but that doesn't work. How can I make this shell statement open word on the user's machine with this document?

Here is the code:
Private Sub cmdCreateCMPR_DDRpt_Click()
'Creates the report then opens in Word
Shell ("isqlw -S GL_Server1 -d TesteDB1 -U sa -P 4illiad -i \\GL_Server1\IMData\CMPRRptNos_qry.sql -o \\GL_Server1\glexpdata\DD_CMPRImportNumbers_out.rtf")
Shell "c:\prgra~1\micros~1\office\winword.exe \\GL_Server1\glexpdata\DD_CMPRImportNumbers_out.rtf", vbNormalFocus
End Sub
 
Can you use the CreateObject method rather than the shell command? Then, it will not depend on Word's path.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top