Hello all i have a macro like shown bellow. Can someone please add me the lines of code that would somehow remember the original file name, close the renamed file after renaming, and reopen the original file. It would be even better if it is possible to save file as new one without closing and reopening the original one. Thank you
Sub Save_as()
Dim i As Variant
Dim fPath As String
i = InputBox("New name", "Save as")
Range("BN2").Value = i
Dim ans As VbMsgBoxResult
ans = MsgBox("Add more description", vbQuestion + vbYesNo)
If ans = vbYes Then
fPath = ThisWorkbook.Path & Application.PathSeparator
ThisFile = fPath & Range("BO2").Value
ActiveWorkbook.SaveAS Filename:=ThisFile
Else
fPath = ThisWorkbook.Path & Application.PathSeparator
ThisFile = fPath & Range("BP2").Value
ActiveWorkbook.SaveAS Filename:=ThisFile
End If
End Sub
Sub Save_as()
Dim i As Variant
Dim fPath As String
i = InputBox("New name", "Save as")
Range("BN2").Value = i
Dim ans As VbMsgBoxResult
ans = MsgBox("Add more description", vbQuestion + vbYesNo)
If ans = vbYes Then
fPath = ThisWorkbook.Path & Application.PathSeparator
ThisFile = fPath & Range("BO2").Value
ActiveWorkbook.SaveAS Filename:=ThisFile
Else
fPath = ThisWorkbook.Path & Application.PathSeparator
ThisFile = fPath & Range("BP2").Value
ActiveWorkbook.SaveAS Filename:=ThisFile
End If
End Sub