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
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