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
 
What code are you using to open the document and to close it?
 
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.
 

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

Back
Top