I really could use some advice. I am new to this forum, so please forgive my mistakes.
Thanks, in advance.
I wish to have a button launched macro that saves my workbook to a new folder -both of which are named after cells on the active worksheet.
So far, I can get the folder created (from "E4"), and then the file created (from both "E4" and "E7") - but the saved file ends up outside of that folder.
I would like it to be saved IN that folder, if possible.
Any help would be greatly appreciated. Thanks again!
This is what I have:
Sub UploadFileTo_G()
Application.DisplayAlerts = False
Dim SaveName As String
SaveName = ActiveSheet.Range("E4").Value
MkDir "G:\Service\SN INSPECTIONS" & SaveName
Dim FileName As String
FileName = ActiveSheet.Range("E4").Value & "_" & Range("E7")
'trying to place the named file into the created folder...
ActiveWorkbook.SaveAs FileName:="G:\Service\SN INSPECTIONS" & FileName & ".xlsm"
(but of course, it appears OUTSIDE of the folder...)
I found (something like) this on this forum, which addresses my kind of problem... but unfortunately, I had a very similar result:
Option Explicit
Const MYPATH As String = "G:\Service\SN INSPECTIONS"
Sub IfNewFolder()
Dim part3 As String
part3 = Range("E4").Value
If Len(Dir(MYPATH & part3, vbDirectory)) = 0 Then
MkDir MYPATH & part3
End If
End Sub
Sub SaveCustomizedCourse()
Dim part1 As String
Dim part3 As String
part1 = Range("E4").Value 'ORDER
part3 = Range("E7").Value 'SERIAL
IfNewFolder
ActiveWorkbook.SaveAs FileName:= _
MYPATH & part1 & " " & part3 & ".xlsm", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub
Thanks, in advance.
I wish to have a button launched macro that saves my workbook to a new folder -both of which are named after cells on the active worksheet.
So far, I can get the folder created (from "E4"), and then the file created (from both "E4" and "E7") - but the saved file ends up outside of that folder.
I would like it to be saved IN that folder, if possible.
Any help would be greatly appreciated. Thanks again!
This is what I have:
Sub UploadFileTo_G()
Application.DisplayAlerts = False
Dim SaveName As String
SaveName = ActiveSheet.Range("E4").Value
MkDir "G:\Service\SN INSPECTIONS" & SaveName
Dim FileName As String
FileName = ActiveSheet.Range("E4").Value & "_" & Range("E7")
'trying to place the named file into the created folder...
ActiveWorkbook.SaveAs FileName:="G:\Service\SN INSPECTIONS" & FileName & ".xlsm"
(but of course, it appears OUTSIDE of the folder...)
I found (something like) this on this forum, which addresses my kind of problem... but unfortunately, I had a very similar result:
Option Explicit
Const MYPATH As String = "G:\Service\SN INSPECTIONS"
Sub IfNewFolder()
Dim part3 As String
part3 = Range("E4").Value
If Len(Dir(MYPATH & part3, vbDirectory)) = 0 Then
MkDir MYPATH & part3
End If
End Sub
Sub SaveCustomizedCourse()
Dim part1 As String
Dim part3 As String
part1 = Range("E4").Value 'ORDER
part3 = Range("E7").Value 'SERIAL
IfNewFolder
ActiveWorkbook.SaveAs FileName:= _
MYPATH & part1 & " " & part3 & ".xlsm", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
End Sub