Hi all!
I am trying to make macro to change and save file separately:
To change name I am using:
It works fine. It changes name. Then user makes some changes in sheet and right after it I need to save it in specific folder. Here I am using:
But it saves file without changed name. So lets say file name was OOO. User changed it using first macro for TEST OOO. Then, when they want to save it, it goes as OOO instead of TEST OOO using second macro. Any ideas how to fix it so it saves the file with name changed?
I am trying to make macro to change and save file separately:
To change name I am using:
VBA Code:
Sub AddTicketNrToFileName()
Dim NewName As String
NewName = InputBox("Insert Ticket Number", "Change file's name")
Dim CurrentName As String
CurrentName = ActiveWorkbook.Name
ActiveWorkbook.Windows(1).Caption = NewName & " " & CurrentName
End Sub
It works fine. It changes name. Then user makes some changes in sheet and right after it I need to save it in specific folder. Here I am using:
VBA Code:
Sub SaveTicket()
Dim z As Workbook
Set z = ActiveWorkbook
z.SaveAs "C:\KRA\" & z.Name
End Sub
But it saves file without changed name. So lets say file name was OOO. User changed it using first macro for TEST OOO. Then, when they want to save it, it goes as OOO instead of TEST OOO using second macro. Any ideas how to fix it so it saves the file with name changed?