Access VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello, when i call from access a word document and i close it. it retuns a
message "An unexpected error has occurred". Anyone can tell me how i
eliminate that.
Regards
Carlos
 
to open word doc i use:

Command24.HyperlinkAddress = recordsetx.Fields(0)

to close word doc i don't have any code
 
If you open the Word document normally (i.e.: not from within Access) and
close it, does it close without error?
 
yes. it close without error

Douglas J. Steele said:
If you open the Word document normally (i.e.: not from within Access) and
close it, does it close without error?
 
Douglas -

So what are the advantages of using this method, as opposed to creating
an instance of Word using CreateObject, opening the file and then
displaying it? I'm assuming that 1 of the advantages is that Access will
look at the file extension and open the correct application? Are there
others?
 
Using a hyperlink lets you open the document in its registered program, and
nothing else.

Opening an instance of Word using CreateObject lets you use automation on
the document.

Which is better depends on what you're doing.
 
Do other documents have this same problem if you open them from within
Access and then close them?
 
Just realized this isn't strictly true.

If you open the document using the hyperlink, you can always get a reference
to that instance of Word using GetObject, and then use automation that way.
 
Back
Top