file naming

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've set up a template with a couple of parameters that are entered using
FILLIN when a new doc is created from the template.
Is there some way of using these parameters to set the file name when the
new doc is saved for the first time?

Never used VBA .. but all advice welcomed!

Thanks in advance
Dick V
 
Hi =?Utf-8?B?RGlja1Y=?=,
I've set up a template with a couple of parameters that are entered using
FILLIN when a new doc is created from the template.
Is there some way of using these parameters to set the file name when the
new doc is saved for the first time?

Never used VBA .. but all advice welcomed!
It would certainly require VBA. You'd need to select each of the Fillin
fields and assign them bookmarks. Then the macro can pick up the content
fairly easily. Example:

Sub FileSaveAs
Dim fileName as String
Dim doc as Word.Document

Set doc = ActiveDocument
fileName = doc.Bookmarks("FirstPart").Range.Text _
& doc.Bookmarks("SecondPart").Range.Text & ".doc"
doc.SaveAs fileName
End Sub

Where "FirstPart" and "SecondPart" represent bookmark names assigned in
Insert/Bookmark

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
 

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

Back
Top