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

Need to start WORD and open a specific doc ??? 1

Status
Not open for further replies.

Dylan

MIS
Aug 27, 1998
109
US
I have a button on a form with code which opens WORD but I would like it to open a specific document when it opens.
The file I want to open has spaces in the filename.
ex "\\Treas_data_fs1\DATA\Senior Citizen\Letter.doc"

Any help would be greatly appreciated ...

thanks Tom

Here is my code so far
(which starts WORD ok with no current document)

##########################################################
Dim oApp As Object

Set oApp = CreateObject("Word.Application")
oApp.Visible = True


Tom Moran
Lansing, Michigan
 
I think you can use the shell command to run a shortcut.

Something like this should work:

Shell "X:\Office2K\MSOffice\office\WinWord.EXE '\\Treas_data_fs1\DATA\Senior Citizen\Letter.doc'"

Obviously you'll have to change the file paths accordingly.

Ed Metcalfe.

Please do not feed the trolls.....
 
Dim oApp As Object

Set oApp = CreateObject("Word.Application")
oApp.Visible = True

oApp.Documents.Open FileName:="\\Treas_data_fs1\DATA\Senior Citizen\Letter.doc
 
Thanks for the help. It now works as I intended.



Tom Moran
Lansing, Michigan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top