View Single Post
 
Old 05-09-2017, 06:27 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You really haven't given enough information to go on, as to either the path or what these 'forms' are.

Here's some code to get you started. It assumes the desired filename is in the first content control in the document and that you want to save the file to the user's 'Documents' folder. The first sub pops up a populated SaveAs dialogue; the second simply saves the file without prompting.
Code:
Sub SaveDocAsPDF1()
Application.ScreenUpdating = False
Dim StrFlNm As String
With ActiveDocument
  StrFlNm = .ContentControls(1).Range.Text
  With Application.Dialogs(wdDialogFileSaveAs)
    .Name = "C:\" & Environ("UserName") & "\Documents\" & StrFlNm
    .Format = wdFormatPDF
    .Show
  End With
End With
Application.ScreenUpdating = True
End Sub

Sub SaveDocAsPDF2()
Application.ScreenUpdating = False
Dim StrFlNm As String
With ActiveDocument
  StrFlNm = .ContentControls(1).Range.Text
  .SaveAs2 FileName = "C:\" & Environ("UserName") & "\Documents\" & StrFlNm & ".pdf", FileFormat:=wdFormatPDF
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote