Eddie Runde was telling us:
Eddie Runde nous racontait que :
> I would like to have the name of new documents (based upon a
> particular template) to be automatically generated based upon fields
> within the document.
> For example: Name the document based upon a client's name and
> date of service.
> Can this be done? If so, how?
Yes, but it is a bit more involved than you might think.
What if the user types illegal characters in the name or date fields?
When will the save action occur?
When the document is first created?
When the document is closed?
When the user wants to save?
What if the user creates a document based on that template, but then wants
to close without saving?
If the whole thing is to be automatic, which folder should be sued to store
the saved document?
Are we talking about a document protected for forms?
In any case, here is some code to get you going:
'_______________________________________
Dim myFileName As String
With ActiveDocument.FormFields
myFileName = .Item("NameClient").Result _
& "_" & .Item("DateCLient").Result
End With
With Dialogs(wdDialogFileSaveAs)
.Name = myFileName
.Show
End With
'_______________________________________

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org