Solved: Retrieving a File from Shared Folder and Saving as New File in Shared Folder

MakeItWorkVBA

New Member
Joined
Jan 20, 2021
Messages
1
Office Version
  1. 365
  2. 2011
  3. 2010
Platform
  1. 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
 

Some videos you may like

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Watch MrExcel Video

Forum statistics

Threads
1,127,477
Messages
5,624,977
Members
416,065
Latest member
meiravmeron

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top