Hi Greg Maxey
Absolutely! The first thing is to make sure you have the VBA help
files installed. From within the VBA IDE you can then select the
word "Close" from ActiveDocument.Close and press F1. On the system
I've currently got booted (Word 2003) I get the following info from
the helpfile:
Closes the specified document or documents.
expression.Close(SaveChanges, OriginalFormat, RouteDocument)
expression Required. An expression that returns one of the above
objects.
SaveChanges Optional Variant. Specifies the save action for the
document. Can be one of the following WdSaveOptions constants:
wdDoNotSaveChanges, wdPromptToSaveChanges, or wdSaveChanges.
OriginalFormat Optional Variant. Specifies the save format for the
document. Can be one of the following WdOriginalFormat constants:
wdOriginalDocumentFormat, wdPromptUser, or wdWordDocument.
RouteDocument Optional Variant. True to route the document to the
next recipient. If the document doesn't have a routing slip attached,
this argument is ignored.
Also, you can use the ObjectBrowser (F2). You can then browse to
Document, Close. In the pane at the bottom of the window it will
display:
Sub Close([SaveChanges], [OriginalFormat], [RouteDocument])
Member of Word.Document
The online help is the most helpful as it informs you that the
parameter SaveChanges is an Enum of type WdSaveOptions.
WdSaveOptions has the following constants defined for it
wdDoNotSaveChanges, wdPromptToSaveChanges and wdSaveChanges.
You should use the names (wdDoNotSaveChanges, wdPromptToSaveChanges
or wdSaveChanges) rather than try to find and use their numeric
value. The whole point of an Enum is that it generates a list of
named constants that makes the code more comprehensible.
Me thinks you would find it extremely useful to purchase a book on
VBA or VB!
HTH + Cheers - Peter
Is there a way of finding a list of the various arguments a method
can have.
I stumbled around for over an hour the other day trying to find the
correct "=wdDoNotSaveChanges" to replace "wdPromtToSaveChanges"
found in the
following VBA Help example for the Close method.
ActiveDocument.Close _
SaveChanges:=wdPromptToSaveChanges, _
OriginalFormat:=wdPromptUser
Since there doesn't appear to be a auto suggestion feature for these
"wd...." type elements and the help file only listed this one
example, how
do you learn what works other than repeated guessing at what might
work?
Thanks.