judgejustin
Board Regular
- Joined
- Mar 3, 2014
- Messages
- 142
I am trying to copy a workbook and save it as a new file. The problem, using the code below, is that it references the macros in the new workbook back to the original. I need the macros copied along with the workbook. Can someone tell me if I am missing something or just going about it completely wrong.
Code:
Sub Create_New_Workbook_Click()
Set NewBook = Workbooks.Add
ThisWorkbook.SaveAs
ActiveWorkbook.Sheets("Sheet1").Visible = False
ActiveWorkbook.Sheets("Void Control").Visible = False
ActiveWorkbook.Sheets("Set-Up Voids").Visible = False
Dim myValue As Variant
myValue = InputBox("Enter Tax Roll Sequence # of the Parcel to be voided.", "Void Sheet Input", 0)
ActiveSheet.Unprotect "password"
Range("F17").Value = myValue
ActiveSheet.Protect "password"
Dim sFile As String
Dim sPath As String
sFile = Range("F17").Value & ".xlsm"
sPath = "\" & sFile
ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & sFile, FileFormat:=52
End Sub