How do i save mutiple files to backup

ghrek

Active Member
Joined
Jul 29, 2005
Messages
426
Hi

I was given this macro to do back ups. I fully understand that this can be run from a specific workbook. What im trying to do is run this macro on 4 workbooks in different locations and then once all moved into "D" drive I need a subfolder creating and it ask me to name it and then move all the files that are not in a folder into it.
Also if I can I want to be able to click on the macro in 1 workbook and then does what it needs to in other three.

There will be other folders in the folder "D:" as I want to do a back up every 4 weeks.

Sub SaveWorkbookBackupToFloppy()

Dim AWB As Workbook, BackupFileName As String, i As Integer, Ok As Boolean
Dim DriveName As String

On Error GoTo NotAbleToSave

'Specify the path for making back up in D drive
DriveName = "D:"

'Initializing the variables
Set AWB = ActiveWorkbook
BackupFileName = AWB.Name
Ok = False

'Checking whether file is saved
'If file is not saved then saving the file
If AWB.Path = "" Then
'Displaying Save as dialog box for file saving
Application.Dialogs(xlDialogSaveAs).Show
Else
'Deleting file if backup file already exists
If Dir(DriveName & BackupFileName) <> "" Then
Kill DriveName & BackupFileName
End If

Can anyone help?

Thanks
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,214,944
Messages
6,122,387
Members
449,080
Latest member
Armadillos

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