Opening (Word) document

  • Thread starter Lodewijk Olthof
  • Start date
L

Lodewijk Olthof

On my form I have the following fields
cboReference (containg the name of a file without extension)
txtPath (containing the full path to the document)
txtFileType (containing the type of file; Word, Access, Excel, PowerPoint)

Know I want to create a button to open that specific file.
With the Select Case statement on txtFileType I can find out what type of
file I have to open. When it is a Word document, I have tot open the file
txtOpenDocument = txtPath & cboReference & ".doc".

To open Word I can use something like Set oApp =
CreateObject("Word.Application") and then oApp.Visible = True.
But how do I get the txtOpenDocument in Word?

Lodewijk
 
D

Dirk Goldgar

Lodewijk Olthof said:
On my form I have the following fields
cboReference (containg the name of a file without extension)
txtPath (containing the full path to the document)
txtFileType (containing the type of file; Word, Access, Excel,
PowerPoint)

Know I want to create a button to open that specific file.
With the Select Case statement on txtFileType I can find out what
type of file I have to open. When it is a Word document, I have tot
open the file txtOpenDocument = txtPath & cboReference & ".doc".

To open Word I can use something like Set oApp =
CreateObject("Word.Application") and then oApp.Visible = True.
But how do I get the txtOpenDocument in Word?

Lodewijk

Do you actually need to automate Word (whatever application may be
appropriate), or is it enough to open it and let the user work with it
normally? If the latter, and it's a registered file type, then I
recommend you just use a line like

Application.FollowHyperlink txtOpenDocument

or else call the ShellExecute API using the code posted here:

http://www.mvps.org/access/api/api0018.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top