Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing Word from Access - Quicky? 2

Status
Not open for further replies.

Binnit

Technical User
Apr 28, 2004
627
US
I have some code which opens a "Read only" Word document, inserts some Access data, prints the document....

Now I need to close the document Without saving.

Code:
With objWord
       .Visible = False
       .ActiveDocument.close
End With

Please can anyone tell me the syntax for this so that it does not bring up the "save as" dialog.

The line
.ActiveDocument.close does not work and when the user selects "cancel" via the SaveAs dialog it errors out.


If IT ain’t working Binnit and Reboot
 
try
Code:
objWord.Quit False
Set objWord = nothing

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
1DMF

Star for you - did exactly what I wanted - many thanks

I was entrenched that the answer must be using Close rather than Quit!



If IT ain’t working Binnit and Reboot
 
Hey no probs, glad I could help. :)

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
And without quitting word:
With objWord
.Visible = False
[!].ActiveDocument.Saved = True[/!]
.ActiveDocument.Close
End With

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
.ActiveDocument.Saved = True

does that save the document or set the flag as if it had been saved?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Thanks for the alternative option PHV

If IT ain’t working Binnit and Reboot
 
does that save the document or set the flag as if it had been saved?
set the flag only.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top