Macro, answering pop-up dialog boxes

N

nomail

I'm a newbe with macro's and VBA. We're trying to record a
macro in Word 2000. It works well except that the pop-up
dialog boxes must be manually answered. For example, Do
you want to save the file? Yes / No. We always answer the
No. Can the macro be made to answer these? We tried both a
mouse click as well as the Alt key (i.e. Alt+N) when
recording the macro.

Any suggestions?

Thanks.

Jim
 
J

Jean-Guy Marcil

Hi Jim,

Post your code and someone will assist you.

Or, in case you want to try to figure it out by yourself, here is a little
quiz:

Where in your code would it be most appropriate to include the following:

ActiveDocument.Saved =True

???

--
Cheers!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jim

Can you tell me where to insert the code in the macro? The
question Do you want to save the "filename.doc"? Yes No
Cancel is asked twice when the macro is played.

Thanks for the help,

Jim

The code is below:

Sub MainMerge_Diplomas()
'
' MainMerge_Diplomas Macro
' Macro recorded 2/3/2004 by Computer Support Services
'
ChangeFileOpenDirectory "N:\Common\Training
Services\download\"
Documents.Open FileName:="MainMerge.doc",
ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False,
WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
Application.Run MacroName:="DiplomaMerge"
End Sub
 
S

Steve Lang

Hi Jim,

In your DiplomaMerge macro, you are apparently closing a document. If you
don't want to save the changes you are making to filename.doc, then in the
line of code where you are closing the file, add the attribute SaveChanges:=
wdDoNotSaveChanges

e.g. Activedocument.Close SaveChanges:= wdDoNotSaveChanges

HTH and have a great day!

Steve

Can you tell me where to insert the code in the macro? The
question Do you want to save the "filename.doc"? Yes No
Cancel is asked twice when the macro is played.

Thanks for the help,

Jim

The code is below:

Sub MainMerge_Diplomas()
'
' MainMerge_Diplomas Macro
' Macro recorded 2/3/2004 by Computer Support Services
'
ChangeFileOpenDirectory "N:\Common\Training
Services\download\"
Documents.Open FileName:="MainMerge.doc",
ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False,
PasswordDocument:="", _
PasswordTemplate:="", Revert:=False,
WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
Application.Run MacroName:="DiplomaMerge"
End Sub
 

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