save to a area & create a backup too

Trevor3007

Well-known Member
Joined
Jan 26, 2017
Messages
675
Office Version
  1. 365
Platform
  1. Windows
hi,

I would like a macro to save the file in c:\data\data123 & create create a backup too in c:\data\backup\data123_backup.

is this possible?
 
Last edited:

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
.
Code:
Option Explicit


Public Sub SaveWB()
    ThisWorkbook.SaveAs Filename:="[COLOR=#333333]C:\data\data123\[/COLOR]" & ThisWorkbook.Name 
    ThisWorkbook.SaveAs Filename:="[COLOR=#333333]C:\data\backup\data123_backup[/COLOR]\" & ThisWorkbook.Name
End Sub
 
Last edited:
Upvote 0
.
Code:
Option Explicit


Public Sub SaveWB()
    ThisWorkbook.SaveAs Filename:="[COLOR=#333333]C:\data\data123\[/COLOR]" & ThisWorkbook.Name 
    ThisWorkbook.SaveAs Filename:="[COLOR=#333333]C:\data\backup\data123_backup[/COLOR]\" & ThisWorkbook.Name
End Sub


morning [FONT=&quot]Logit,

many thanks for you help.
The user wants to save to :-

[/FONT]
H:\Asset

[FONT=&quot]and the backup to:-
[/FONT]
H:\Asset\Backup

[FONT=&quot]I altered the path in your code to:-
Code:
[/FONT][/COLOR]  ThisWorkbook.SaveAs Filename:="H:\Asset" & ThisWorkbook.Name[COLOR=#201F1E][FONT=&quot]
[/FONT][/COLOR]
    ThisWorkbook.SaveAs Filename:="H:\Asset\Backup" & ThisWorkbook.Name[COLOR=#201F1E][FONT=&quot]

but although it goes through the motaions ( no erros received ) it does not work?

any suggs ?



[/FONT]
 
Upvote 0
.
Note the \ at the end of the path ...

Code:
ThisWorkbook.SaveAs Filename:="H:\Asset\" & ThisWorkbook.Name


    ThisWorkbook.SaveAs Filename:="H:\Asset\Backup\" & ThisWorkbook.Name
 
Last edited:
Upvote 0
Thank you Logit,

works a treat:}

happy days are here again!!!
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,189
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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