cdbrown
07-11-2006, 06:16 AM
Hi all,
I would like some code that when a user selects a workbook to modify, makes a backup copy of the unmodified wb in a different folder (..Output\Backup\). The user can then modify the wb and it get's saved in it's original location.
Private Sub CommandButton2_Click()
Public SFolder, OpFolder, MyFolder, Fname
Dim wb1, wb2 As Workbook
SFolder = Sheets("List").Cells(7, 6) 'folder to save or copy the backup to
OpFolder = Sheets("List").Cells(1, 6) & "\" 'folder containing the wbs to modify
Set wb1 = ThisWorkbook
ChDir OpFolder
Fname = Application.GetOpenFilename("Excel-files,*.xls", , "Please select the output you wish to modify")
Workbooks.Open Filename:=Fname
I'm not sure if I should be opening the file, then saving the backup or should it copy it before opening.
Again - any help would be much appreciated.
Regards
-cdbrown
I would like some code that when a user selects a workbook to modify, makes a backup copy of the unmodified wb in a different folder (..Output\Backup\). The user can then modify the wb and it get's saved in it's original location.
Private Sub CommandButton2_Click()
Public SFolder, OpFolder, MyFolder, Fname
Dim wb1, wb2 As Workbook
SFolder = Sheets("List").Cells(7, 6) 'folder to save or copy the backup to
OpFolder = Sheets("List").Cells(1, 6) & "\" 'folder containing the wbs to modify
Set wb1 = ThisWorkbook
ChDir OpFolder
Fname = Application.GetOpenFilename("Excel-files,*.xls", , "Please select the output you wish to modify")
Workbooks.Open Filename:=Fname
I'm not sure if I should be opening the file, then saving the backup or should it copy it before opening.
Again - any help would be much appreciated.
Regards
-cdbrown