Hi all
i am having some issues saving an Excel workbook after creating a folder, not sure how to get to save the work book after the folder has been created
I got it to create the folder in the "2017" Folder but can't get it to save the workbook in that created folder after, any ideas? What do i need after path to get it to the new folder?
Thanks guys, was never good at Excel!
i am having some issues saving an Excel workbook after creating a folder, not sure how to get to save the work book after the folder has been created
I got it to create the folder in the "2017" Folder but can't get it to save the workbook in that created folder after, any ideas? What do i need after path to get it to the new folder?
Code:
Sub Makefoldersaver()
'Creates New Folder
Dim FSO
Dim sFolder As String
Dim Ref
Ref = Sheets("Input").Range("T4").Value
sFolder = "C:\Users\User\Documents\Shipments\2017\" & Sheets("Input").Range("T4").Value
Set FSO = CreateObject("Scripting.FileSystemObject")
If Not FSO.FolderExists(sFolder) Then
FSO.CreateFolder (sFolder) 'Checking if the same Folder already exists
Else
MsgBox Ref & " Folder Already Exists", vbExclamation, "Folder Already Exists!"
End If
Dim Filename As String
Dim Path As String
Application.DisplayAlerts = False
Path = "C:\Users\User\Documents\Shipments\2017\"
Filename = Range("T6").Value & ".xlsx"
ActiveWorkbook.SaveAs Path & Filename, xlOpenXMLWorkbook
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub
Thanks guys, was never good at Excel!