Here's what I thought I had accomplished: Remote user has a file they update, as part of the closing the file out, part of it is published to a webpage on another server and the xls is also saved to another server. The macro below is for the saving it to another server as a different file name. It worked fine and then out of the blue when running the macro, I get a "Path/File Access Error".
The reason why I'm trying this method is that the original file has formulas and if you just copy/paste the cells to the new file, the formulas still reference the original file.
Anybody have a sample of vba that copys all the sheets of a worksheet and copies them to a blank one?
Sub SaveWorksheet()
Application.DisplayAlerts = False
Sheets(Array("Instructions", "Dashboard", "Entry", "Budget")).Select
Sheets("Budget").Activate
Sheets(Array("Instructions", "Dashboard", "Entry", "Budget")).Copy
Sheets("Instructions").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Entry").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Budget").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Dashboard").Select
ActiveSheet.Shapes("Button 2").Select
Selection.Delete
ChDir "\\path-to-file\"
ActiveWorkbook.SaveAs Filename:= _
"\\path-to-file\newfile.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close
Application.DisplayAlerts = True
Sheets("Dashboard").Activate
Range("A1").Select
End Sub
Bookmarks