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