Hello everyone. Thanks to everyone who has helped me before. I would like to be able to create a file in a folder; which is created via input from the user. Below is the code that I am trying to use and it does not work. I am recieving a syntax error in Sub Macro1 for Filename. Any help would be greatly appreciated.
Option Explicit
Dim fdate As String
Dim fPath As String
Sub CreateFolder()
fdate = Application.InputBox("Enter a date in the format shown:", "Date to add...", Format(Date, "MM_DD_YYYY"))
If fdate = "False" Then Exit Sub
fPath = "L:\"
On Error GoTo ErrorExit
MkDir fPath & fdate & "_157"
MkDir fPath & fdate & "_157\" & "Disclosure_Reports"
MkDir fPath & fdate & "_157\" & "Support_Files"
MkDir fPath & fdate & "_157\" & "105_Reports"
Exit Sub
ErrorExit:
MsgBox fPath & fdate & " already exists!", vbExclamation, "Folder Exists"
End Sub
Sub Macro1()
Const sPath1 As String = "fPath & fdate & _157\ & 105_Reports\"
Const sFileOut1 As String = "_105_version1.xlsm"
fPath = "L:\"
Workbooks.Add
With ActiveSheet
.Name = fdate & "_105"
.Parent.SaveAs Filename:=sPath1 & sFileOut1,
FileFormat:=xlOpenXMLWorkbookMacroEnabled, _
CreateBackup:=False
.Parent.Close
End With
End Sub
Essentially I am trying to add a workbook to the directory:
MkDir fPath & fdate & "_157\" & "105_Reports"
Bookmarks