Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I use 2 Form fields to automatically populate the FILENAME
I want to automatically save the document with a FILENAME made up of 2, or
more, FORM fields. e.g. Lastname_Firstname_Date.doc Many thanks, -- Richard Spencer Technical Author NDS |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I use 2 Form fields to automatically populate the FILENAME
You will need to run a macro on exit from the second of the relevant fields,
but it will only work if you tab out of the field. At its most basic level - Sub SaveForm() Dim sFname As String Dim sLname As String Dim sDate As String Dim sFilename As String sFname = ActiveDocument.FormFields("First_Name").Result sLname = ActiveDocument.FormFields("Last_Name").Result sDate = Format((Date), "ddMMyyyy") sFilename = sLname & "_" & sFname & "_" & sDate & ".doc" ActiveDocument.SaveAs sFilename End Sub should do that, saving the document in the current folder as (eg) Mayor_Graham_14102006.doc Note the form field bookmark names must be changed to First_Name and Last_Name rather than left at defaults. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Richard Spencer wrote: I want to automatically save the document with a FILENAME made up of 2, or more, FORM fields. e.g. Lastname_Firstname_Date.doc Many thanks, |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I change the tab order for text form fields in Word? | Microsoft Word Help | |||
Form Fields, Macros & Navigating | Tables | |||
how to automatically repeat text in form fields in word doc | Microsoft Word Help | |||
Automatically Update Form Text Fields | Microsoft Word Help | |||
create a Word form that will populate identical fields in other fo | Microsoft Word Help |