View Single Post
 
Old 05-04-2017, 10:39 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You can add the subject string to your macro that saves the document e.g.

Code:
Sub SaveForm()
Dim strPath As String
Dim strName As String
strPath = "C:\Path\"    'Where to save the document
    On Error GoTo err_Handler
    If ActiveDocument.FormFields("User_Name").Result = "" Or _
       ActiveDocument.FormFields("Cell_Phone_Number").Result = "" Then
        MsgBox "Complete name and cell number fields"
        GoTo lbl_Exit
    End If
    strName = "GSS #390 for " & ActiveDocument.FormFields("User_Name").Result & Chr(32) & ActiveDocument.FormFields("Cell_Phone_Number").Result
    strName = strName & ".docx"
    ActiveDocument.SaveAs2 strPath & strName
lbl_Exit:
    Exit Sub
err_Handler:
    If Err.Number = 5941 Then
        MsgBox "One or other of the form fields used to name the documnent is missing!"
        Err.Clear
        GoTo lbl_Exit
    End If
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote