PDA

View Full Version : Use SaveAs to create new workbook



leal72
04-16-2015, 12:14 PM
I have an excel file (MasterCopy.xlsm) that I want to keep as a master copy and do not want any changes made to it. I want the user to open the MasterCopy.xlsm file and for a new file with a unique name (Unique.xlsm) to be created once they open this file. The code I have below does this but it also saves this workbook event and I want the user to be able to edit the Unique.xlsm file.

Is there a way to disable the workbook event for the new file?


Private Sub Workbook_Open()


Dim WbName As String
Dim MainWb As Workbook


Set MainWb = ActiveWorkbook


Do

WbName = InputBox("Save request with unique panel number", "Save unique RTM panel")

Loop While WbName = ""

MainWb.SaveAs Filename:=WbName

End Sub

jonh
04-17-2015, 01:40 AM
If ThisWorkbook.Name = "MasterCopy.xlsm" Then
'do stuff
End If

leal72
04-17-2015, 07:16 AM
Thank you