title: Create A Folder Directory in Excel using Visual Basic
body: <p>I am extremely new to Visual Basic</p>
  
  <p>I am currently trying to create a calculator within excel that I can export the data within to a PDF. I have been able to export the excel document however it is only going to my "D:\". </p>
  
  <p>How do I create a folder within D:\ called something like Excel_Calculator where I can have all the PDF's created be saved directly into that folder &amp; If there already is a folder called "Excel_Calculator" to use that folder instead of overwriting the existing folder.</p>
  
  <p>The code I have for saving the PDF is listed here:</p>
  
  <pre><code>Sub GetFilenameForPDF()
  Dim strFileName As String, strB1 As String, strWorksheet As String
  
  
  strB1 = Range("B1").Value
  strWorksheet = ActiveSheet.Name
  strFileName = strB1 &amp; " " &amp; strWorksheet &amp; " " &amp; Format(Date, "DD-MM-YYYY")
  
  
  
  
  Sub SaveToPDF()
  
  Dim strFileName As String, strC3 As String, strWorksheet As String
  strB1 = Range("B1").Value
  strWorksheet = ActiveSheet.Name
  strFileName = strB1 &amp; " " &amp; strWorksheet &amp; " " &amp; Format(Date, "DD-MM-YYYY")
  
  ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
      "D:\" &amp; strFileName &amp; ".pdf", _
      Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
      :=False, OpenAfterPublish:=True
      End Sub
  </code></pre>
  
  <p>** EDIT: Or is there a way I can create or redirect the files to a temporary location so that the folder isn't clogged up and the user can print/save the PDF when needed?**</p>