Auto saving shared files

mcmdm50

New Member
Joined
Mar 25, 2012
Messages
14
I created a macro that opens 4 workbooks (named Qtr 1, Qtr 2, Qtr 3, Qtr 4) from a larger workbook with 8 sheets.
I run code in each book and then I would like to close and save each one but I can't get that part to work. for the people who share the file with me.
I can only figure out how to save it to my desktop but not save to the desktop of others.
Can anyone help?
Thanks,
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Something like this:

Code:
ThisWorkbook.SaveAs CreateObject("WScript.Shell").specialfolders("Desktop") & "\" & ThisWorkbook.Name & ".xlsx"
ThisWorkbook.Close

CreateObject("WScript.Shell").specialfolders("Desktop") should get you the filepath for their desktop.
 
Last edited:
Upvote 0
That closed the main workbook after copying the worksheet to a new workbook so the next 3 did not copy.
The new workbook didn't save.
The following code worked with my computer....Is there any modification I can make to this so that it can save to all.
ActiveWorkbook.SaveAs Filename:="C:\Users\Mike\Desktop\Qtr 1.xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
 
Upvote 0
Sorry, I thought you were a bit more on top of things. It was just a loose example.

Here:

ActiveWorkbook.SaveAs Filename:= CreateObject("WScript.Shell").specialfolders("Desktop") & "\\Qtr 1.xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

FYI ThisWorkbook will refer to the book the Macro is in.
ActiveWorkbook will refer to whatever book is currently active.
 
Last edited:
Upvote 0
No, just learning, but trying to become more proficient.
This worked very well.
Thank you very much for your assistance.
 
Upvote 0

Forum statistics

Threads
1,214,846
Messages
6,121,905
Members
449,054
Latest member
luca142

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
Back
Top