The problem I have is that i want to a) write a renamed copy of a current workbook, then b) close that version and c) continue working on the original workbook. I can manage a) but b) and c) elude me. It seems once I write the renamed workbook, the workbook I was working on now has that name, which seems reasonable. I show the relevant code below:-
Set Masterfile = ThisWorkbook
Fname1 = ActiveWorkbook.Name
If InStr(Fname1, ".") > 0 Then
Fname2 = Left(Fname1, InStr(Fname1, ".") - 1)
End If
relPath = ThisWorkbook.Path & "\" & Fname2 & Format(Date, ("ddmmyyyy")) & _
" " & Format(Time, "hhmm") & ".xlsm"
' Fname = ActiveWorkbook.Name
ThisWorkbook.SaveAs Filename:=relPath
' here is where I want to close the renamed workbook and continue processing the original workbook
Look forward to suggestions.
Thanks
Martyn
Set Masterfile = ThisWorkbook
Fname1 = ActiveWorkbook.Name
If InStr(Fname1, ".") > 0 Then
Fname2 = Left(Fname1, InStr(Fname1, ".") - 1)
End If
relPath = ThisWorkbook.Path & "\" & Fname2 & Format(Date, ("ddmmyyyy")) & _
" " & Format(Time, "hhmm") & ".xlsm"
' Fname = ActiveWorkbook.Name
ThisWorkbook.SaveAs Filename:=relPath
' here is where I want to close the renamed workbook and continue processing the original workbook
Look forward to suggestions.
Thanks
Martyn