Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Richard Spencer Richard Spencer is offline
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change the tab order for text form fields in Word? copperkid Microsoft Word Help 1 August 1st 06 10:24 PM
Form Fields, Macros & Navigating LPS Tables 2 June 22nd 06 05:13 PM
how to automatically repeat text in form fields in word doc joe17 Microsoft Word Help 2 October 27th 05 08:23 PM
Automatically Update Form Text Fields Brendan Vassallo Microsoft Word Help 3 May 4th 05 05:35 AM
create a Word form that will populate identical fields in other fo Texas Typesetter Microsoft Word Help 2 April 11th 05 06:10 PM


All times are GMT +1. The time now is 05:45 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"