Creating Directory and saving the excel file via VBA
<p>I'm Trying to create a directory in excel-VBA and then copy the xlsm and ,pdf file into this directory.   </p>

<p>I can create the directory but I can't seem to save the files into this directory?  </p>

<p>Code below. Any Help is much appreciated.  This is driving me crazy.  All I'm doing is concatenating the filename and it's being saved to the c:\temp folder, but I want it to save it into a sub folder in c:\temp  </p>

<pre><code>Sub Macro2()
'
' Macro2 Macro
'
Dim FileName As String
Dim FileName2 As String
'FileName3 As String


FileName = Sheet1.TextBox1.Text
FileName2 = ("C:\TEMP\" &amp; FileName)
'CheckDir As String


MsgBox (FileName2)
MkDir (FileName2)


 ChDir (FileName2)

    ActiveWorkbook.SaveAs FileName:=FileName2 &amp; FileName &amp; "2xlsm.xlsm" _
        , FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
        FileName2 &amp; "FileName" &amp; "_2xlsm.pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        True

End Sub
</code></pre>

<p><a href="http://i.stack.imgur.com/b4Bxa.png" rel="nofollow">enter image description here</a></p>