title: Save PDF in a specific folder programmatically
body: <p>I am trying to get this program to save my pdf files in the same folder that the excel template is being saved in which is my Template Code folder. 
  Here is the code that I have so far. The part where I am stuck is down at the bottom at "Dim Save Path.."  </p>
  
  <p>Any suggestions are greatly appreciated!</p>
  
  <pre><code>Sub SaveToPDF()
  
  Dim fp As String
  Dim fp1 As String
  Dim i As Integer
  Dim Max As Integer
  Dim numprints As Integer
  Dim fnum As String
  Dim wb As Workbook
  
  i = 1
  
  fnum = Sheets("Sheet2").Range("B3").Value
  
  Worksheets("Printable").Activate
  Set wb = ActiveWorkbook
  
  'counting the number of pagebreaks to identify number of prints
  Max = ActiveSheet.HPageBreaks.Count
  
  numprints = Max / 2
  k = 10
  
  'to get the file name for each PDF and setting the folder to print
  For j = 1 To numprints
      fp1 = CStr(fnum &amp; " - " &amp; (Replace(Sheets("Printable").Range("f" &amp; k).Value, "/", "-")))
      fp = CStr("Q:\PATS\24-7\Partnership Accounting\2013\2013 TAX\2013 Clients\8392 - 8413 AAF Master Folder\PDF\" &amp; fp1 &amp; ".pdf")
  
  ' exports 2 pages at a time and creates a PDF, then loops
      wb.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fp, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False, From:=i, To:=i + 1
  
      i = i + 2
      k = k + 70
  Next j
  MsgBox ("Print to PDF Complete, Check if you have " &amp; numprints &amp; " PDF Files")
  
  
  
  'save the pdf in the 8392-8413 Master Folder under the Template Code Folder
  
  
         Dim SaveName As String
  
         SaveName = ActiveSheet.Range("G3").Text
              ActiveWorkbook.SaveAs Filename:=SaveName &amp; ".xls"
  
  
  
  Dim SavePath As String
  
  
  SavePath = CStr("Q:\PATS\24-7\Partnership Accounting\2013\2013 TAX\2013 Clients\8392 - 8413 AAF Master Folder\Template Code" &amp; fp1 &amp; ".pdf")
  
              SavePath = wb.Path
  
              ChDir SavePath
              ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ 
                   SavePath &amp; "Form 8392-8413 - " &amp; ".pdf" _
                  , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
                  :=False, OpenAfterPublish:=True
  
  
  End Sub
  </code></pre>