![]() |
#9
|
||||
|
||||
![]()
The message says Compile Error - expected Function or Variable and highlights SaveAs2.
SaveAs2 incidentally is not available in Word 2007, but the OP says 2013 and in that version the following change doesn't produce the error. Code:
With ActiveDocument strfname = "C:\Users\" & Environ("Username") & "\Documents\" & .SelectContentControlsByTitle("Title")(1).Range.Text & ".PDF" .SaveAs2 Filename:=strfname, FileFormat:=wdFormatPDF End With
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
kp2009 | Word VBA | 5 | 08-27-2015 11:45 PM |
![]() |
Oliver Beirne | Word VBA | 4 | 10-19-2012 03:33 AM |
Macro to populate a text form field based on dropdown selection | koloa | Word | 0 | 10-20-2011 11:52 AM |
![]() |
Knawl | Word | 11 | 10-10-2011 03:00 AM |
![]() |
amym | Mail Merge | 1 | 12-07-2010 05:14 AM |