How can I open a Word file from Access with a macro?

M

Michael O

I have a database that has a file in word that is assocaited with the database.

How can I open the word file with a macro in Acesss.

Thanks
 
W

Wolfgang Kais

Hello Michael.

Michael O said:
I have a database that has a file in word that is assocaited with the
database.
How can I open the word file with a macro in Acesss.

Use the RunApplication action, and as commandline argument, use
"PathToWinword.exe" "PathToDocument.doc"
Here, "PathToWinword.exe" is the complete path and filename of
Microsoft Word, for example
"C:\Program Files\Mocrosoft Office\Office11\Winword.exe"
and "PathToDocument.doc" is the complete path and filename of the
document you want to open.
 
M

Michael O

Hi Wofgang

The path to winword works fine. Thank you.

The path to my document doesn't work.
It's H:\0mof\copiers\copier readings instructions.doc

How does this follow on from the path to winword?

Cheers
 
C

csc159

You might want to try to use the UNC path if it's on a server or something

Example: \\SERVERNAME\SHARENAME\0mof\copiers\copier readings instructions.doc

Michael said:
Hi Wofgang

The path to winword works fine. Thank you.

The path to my document doesn't work.
It's H:\0mof\copiers\copier readings instructions.doc

How does this follow on from the path to winword?

Cheers
Hello Michael.
[quoted text clipped - 9 lines]
and "PathToDocument.doc" is the complete path and filename of the
document you want to open.
 
S

Steve Schapel

Michael,

Are you enclosing it is ""s? Should be like this...
"C:\Program Files\whatever\winword.exe" "H:\0mof\copiers\copier readings
instructions.doc"
 
W

Wolfgang Kais

Hello Michael.

The path to winword works fine. Thank you.

The path to my document doesn't work.
It's H:\0mof\copiers\copier readings instructions.doc

How does this follow on from the path to winword?

Since the path to the document contains a space, it must be enclosed
in quotation marks: "H:\0mof\copiers\copier readings instructions.doc"
Otherwise, Winword would interprete the parameter as three separate
values: "H:\0mof\copiers\copier", "readings" and "instructions.doc"
 

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