MakeItWorkVBA
New Member
- Joined
- Jan 20, 2021
- Messages
- 1
- Office Version
- 365
- 2011
- 2010
- Platform
- Windows
Code below will allow you to pull a template file from a shared folder that you have access to that is not on your computer but is shared with you. It will then save that template in that shared folder file as the name you would like to save it as. It will save .XLSM file.
Private Sub FILETOSAVE()
Dim FileName1 As String
Dim FileStore As String
Dim wb As Workbook
Dim Dtitle As String
Dim Code As String
Dim Title As String
Dtitle = Format(Now, " yyymmdd") & ".xlsm"
Title = "23457_Master Project Template_44213"
Code = "12345"
LTitle = "\\THECOMPUTERNAMEWITHSHAREDFOLDER\Users\THEUSERNAMEWITHSHAREDFOLDER\desktop\AFILEFOLDER\"
Ownername = "YOURNAMEFORWHATEVER"
'This bottom part is what I am letting you know. How to save .xlsm to a shared folder not on your computer. notice the difference in the backslash and the forwardslash. Forward slash will allow you to save to that file folder that is shared
Set wb = Workbooks.Add("//THECOMPUTERNAMEWITHSHAREDFOLDER/Users/THEUSERNAMEWITHSHAREDFOLDER/desktop/AFILEFOLDER/FILEYOUAREUSINGASTEMPLATE.xlsm")
Application.DisplayAlerts = False
wb.SaveAs FileName:= _
LTitle & Ownername & "\" & Code & "_" & Title & "_" & Dtitle, _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
FileStore = LTitle & Ownername & "\" & Code & "_" & Title & "_" & Dtitle
wb.Close FileName:=FileStore
End Sub
Private Sub FILETOSAVE()
Dim FileName1 As String
Dim FileStore As String
Dim wb As Workbook
Dim Dtitle As String
Dim Code As String
Dim Title As String
Dtitle = Format(Now, " yyymmdd") & ".xlsm"
Title = "23457_Master Project Template_44213"
Code = "12345"
LTitle = "\\THECOMPUTERNAMEWITHSHAREDFOLDER\Users\THEUSERNAMEWITHSHAREDFOLDER\desktop\AFILEFOLDER\"
Ownername = "YOURNAMEFORWHATEVER"
'This bottom part is what I am letting you know. How to save .xlsm to a shared folder not on your computer. notice the difference in the backslash and the forwardslash. Forward slash will allow you to save to that file folder that is shared
Set wb = Workbooks.Add("//THECOMPUTERNAMEWITHSHAREDFOLDER/Users/THEUSERNAMEWITHSHAREDFOLDER/desktop/AFILEFOLDER/FILEYOUAREUSINGASTEMPLATE.xlsm")
Application.DisplayAlerts = False
wb.SaveAs FileName:= _
LTitle & Ownername & "\" & Code & "_" & Title & "_" & Dtitle, _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
FileStore = LTitle & Ownername & "\" & Code & "_" & Title & "_" & Dtitle
wb.Close FileName:=FileStore
End Sub