Forum

Save As, but Both N...
 
Notifications
Clear all

Save As, but Both New and Original Remain Open

2 Posts
2 Users
0 Reactions
209 Views
(@webbers)
Posts: 147
Estimable Member
Topic starter
 

I have a functional code, however it closes the original workbook.  I wish for the original and new workbook BOTH to remain open after The Save Macro is run.  It works, but closes the original file, and I am left with the new workbook from the "SaveAs".  Is there a way to alter this code so that BOTH original and new workbooks remain open?

Option Explicit
Sub SaveMeD2()
'Saves filename as value of A1 plus the current date

Dim newFile As String, fname As String
' Cell Range of file name
fname = Range("D2").Value
'Change the date format to whatever you'd like, but make sure it's in quotes
newFile = fname
' Change directory to suit your PC, including USER NAME
ChDir _
"C:Usersbarnes22ProjectsManager Files"
ActiveWorkbook.SaveAs filename:=newFile

End Sub

 
Posted : 18/11/2023 1:27 pm
(@debaser)
Posts: 836
Member Moderator
 

I'd use SaveCopyAs then open the copy if you really need both open:

 

activeworkbook.savecopyas newfile

workbooks.open newfile

 
Posted : 18/11/2023 1:59 pm
Share: