dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,375
- Office Version
- 365
- 2016
- Platform
- Windows
I am trying to create code to save my workbook, then save it again as a string entered in a textbox. I then want it to close the new workbook and reopen the original one. The workbook name can change so I can't use the name of the workbook as a reference point. I have this code so far:
This code saves it, saves it again as the new workbook, closes it, then reopens excel but doesn't open the last workbook that I saved the new workbook from. Can someone help me get the original workbook to open please?
Code:
Private Sub cmdNewTool_Click()
With ActiveWorkbook
.Save
.SaveAs txtNewDoc.Text & ".xlsm"
.Close
End With
Workbooks.Open Application.RecentFiles(1)
End Sub
This code saves it, saves it again as the new workbook, closes it, then reopens excel but doesn't open the last workbook that I saved the new workbook from. Can someone help me get the original workbook to open please?