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!

Opening a file automatically

Status
Not open for further replies.

K3ith

Technical User
Oct 26, 2001
16
0
0
US
Can anyone advise please,

I have a word document defined in the variable newfile, this has the following assigned to it: "C:\misc\" & Me![Car_reg].Value & " - " & Me![user_id].Value & "\" & " Change Request " & Me![Car_reg].Value & " - " & Me![user_id].Value

This goes away and copies and existing document and places it in the misc directory, what I now want to do is place some code behind a button to open the copied document, I have been trying the .open method. I just cannot get this to work.

So basically all I would like to be able to achieve is that a user clicks on a button and this button will open the file assigned to the variable newfile.

Once again all help is appreciated

Thanks
K3ith
 
You can open a word file with

Dim appWord As New Word.Application

appWord.Documents.Open vstrFileName
appWord.Visible = True

'where vstrFileName is the path and filename of the doc to 'open There are two ways to write error-free programs; only the third one works.
 
Great that worked perfectly GHolden

much appreciated
 
If I wanted to open an Excel spreadsheet would i just change dim appword as new word.application to new excel.application.

Any advise appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top