Open document from file

  • Thread starter Thread starter Lodewijk Olthof
  • Start date 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
 
Do you have a reason for dividing the data? The problem with what you are
trying to do is that you are limiting yourself to the applications
mentioned, adding other only when you program them in - also, will
CreateObject("Word.Application") work for WordSatr, Word Perfect, Notepad,
etc? Secerely limiting! If you place the whole file name and path in a
Hyperlink field and point and click, this will open the registered
application, whatever program that may be.

HTH.

Tom.
 
Back
Top