How do you disable the "Do you want to save changes" message?

T

Todd K.

I have successfully (finally) created a form letter Word merge from Access,
but it gives two prompts in the process. The first asks to authorize the SQL
statement, which I understand requires a "key" to turn off. The second is
the request when you close the Word document asking to save it. I would like
it to just close without saving or prompting, is there any way in VB to turn
that off or to just default to "No" without prompting?
 
D

Doug Robbins - Word MVP

ActiveDocument.Close wdDoNotSaveChanges

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
T

Todd K.

I'm getting an "Object Required" error.

Doug Robbins - Word MVP said:
ActiveDocument.Close wdDoNotSaveChanges

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
D

Doug Robbins - Word MVP

You need to replace ActiveDocument with a reference to the document that you
want to close. Without seeing your code, I can't tell exactly how that
should be done. But it is the wdDoNotSaveChanges that should be added to
the present Close statement that you are using that is the key.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
T

Todd K.

Here is my code:

Private Sub MOA_Click()

' Save any changes before printing
DoCmd.RunCommand (acCmdRefresh)
' Turn off the warnings so it will write over old table
DoCmd.SetWarnings False
' Run the dataset Make Table query
DoCmd.OpenQuery "QryWordMOA", acViewNormal, acEdit
' Open the Merge document
Application.FollowHyperlink "C:\Documents and Settings\dlg-todd.kirby\My
Documents\MOA-Practice.doc"
' Turn the warnings back on
DoCmd.SetWarnings True
ActiveDocument.Close wdDoNotSaveChanges
 
D

Doug Robbins - Word MVP

I am not quite sure how you are interfacing with Word and assume that
Application.FollowHyperlink is a command in Access.

Maybe you need

Application.ActiveDocument.Close wdDoNotSaveChanges

I would suggest that you see fellow MVP Albert Kallal's "MergeSingleWord"
utility at:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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