Populate a footer on a protected form with text from mixture of text form fields & drop down form fi

J

johnnykunst

I have a form which generates the filename from various drop down fields/ text fields(for extraction of text in one field, the text is split, only using PART of the entry

I would like to populate the footer with the generated filename BEFORE the file is saved with this auto generated name

The code I am using to create the fileneame & save with this name is (section after "Call RunSpellCheck"

Private Sub CommandButton1_Click(
If ActiveDocument.FormFields("classificationDD").Result = "ENTER REPORT CLASSIFICATION" The
MsgBox "You forgot to fill in the REPORT CLASSIFICATION. This field MUST be filled in before you can save the document
Exit Su
End I
If ActiveDocument.FormFields("nameDD").Result = "ENTER NAME" The
MsgBox "You forgot to fill in YOUR NAME. This field MUST be filled in before you can save the document
Exit Su
End I
If ActiveDocument.FormFields("Date").Result = "Monday, 01-01-2001" The
MsgBox "You forgot to fill in the INCIDENT DATE. This field MUST be filled in before you can save the document
Exit Su
End I
If ActiveDocument.FormFields("Time").Result = "00.00" The
MsgBox "You forgot to fill in the INCIDENT TIME. This field MUST be filled in before you can save the document
Exit Su
End I
If ActiveDocument.FormFields("Location").Result = "BLOCK & ESTATE or STREET or PARK" The
MsgBox "You forgot to fill in the LOCATION NAME. This field MUST be filled in before you can save the document
Exit Su
End I
If ActiveDocument.FormFields("Reportbody").Result = "FULL REPORT- OBJECTIVE ACCOUNT INCLUDING DESCRIPTIONS OF ALL PERSONS INVOLVED" The
MsgBox "You forgot to WRITE THE REPORT. This field MUST be filled in before you can save the document
Exit Su
End I
If ActiveDocument.FormFields("Keywords").Result = "40 CHARACTERS MAXIMUM" The
MsgBox "You fill in KEYWORDS/HEADLINE. This field MUST be filled in before you can save the document
Exit Su
End I

Call RunSpellchec
Dim pStr As Strin
pStr = "C:\Users\John\Desktop\" 'Your director
pStr = pStr + Split(
ActiveDocument.FormFields("nameDD").Result, "/")(0
pStr = pStr + "
pStr = pStr + ActiveDocument.FormFields("classificationDD").Resul
pStr = pStr + "
pStr = pStr + ActiveDocument.FormFields("Location").Resul
pStr = pStr + "
pStr = pStr + ActiveDocument.FormFields("Keywords").Resul
pStr = pStr + "
pStr = pStr + ActiveDocument.FormFields("Date").Resul
ActiveDocument.SaveAs FileName:=pSt
pStr = pStr + " .doc

Dim sCode As Strin
MsgBox "Your Intelligence report was saved to the central WINTEL inbox for processing & emailing. No further action is required; it is now safe to close the document
End Su
 
D

Doug Robbins - Word MVP

Use a DocVariable field in the footer and some code to assign the filename
to the .Value of a variable in the document and have the code update he
DocVariable field in the footer so that the name appears there.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

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

Top