mcelligott
Programmer
I have a workbook saved as a template. When the template opens, it creates a new workbook with the following code.
Private Sub Workbook_Open()
If Worksheets("Set Up").Range("F11").Value = "Y" Then
If Not ActiveWorkbook.MultiUserEditing Then
MyName = Worksheets("Set Up").Range("F8").Value & "ICSForms" & Format(Date, "yyyy_mm_dd"".xls")
ActiveWorkbook.SaveAs Filename:=MyName, accessMode:=xlShared
End If
End If
If Worksheets("Set Up").Range("F11").Value = "N" Then
MyName = Worksheets("Set Up").Range("F8").Value & "ICSForms" & Format(Date, "yyyy_mm_dd"".xls")
ActiveWorkbook.SaveAs Filename:=MyName
End If
End Sub
But gives me the following error.
"The following features can not be saved in a macro-free workbooks:
VB Project
To save a file with these features, click No, and then choose a macro enabled file type in the file type list.
To continue saving as a macro-free workbook, click Yes."
After I click "No", I receive another error.
"Run time error '1004':
VB Projects and XML Sheets can not be saved in macro-free workbooks."
I would like the workbook to have the VBA coding. Does anyone know how to get around these errors?
Any help would be greatly appreciated.
Thanks,
Bob
p.s. I am using Excel 2007
Private Sub Workbook_Open()
If Worksheets("Set Up").Range("F11").Value = "Y" Then
If Not ActiveWorkbook.MultiUserEditing Then
MyName = Worksheets("Set Up").Range("F8").Value & "ICSForms" & Format(Date, "yyyy_mm_dd"".xls")
ActiveWorkbook.SaveAs Filename:=MyName, accessMode:=xlShared
End If
End If
If Worksheets("Set Up").Range("F11").Value = "N" Then
MyName = Worksheets("Set Up").Range("F8").Value & "ICSForms" & Format(Date, "yyyy_mm_dd"".xls")
ActiveWorkbook.SaveAs Filename:=MyName
End If
End Sub
But gives me the following error.
"The following features can not be saved in a macro-free workbooks:
VB Project
To save a file with these features, click No, and then choose a macro enabled file type in the file type list.
To continue saving as a macro-free workbook, click Yes."
After I click "No", I receive another error.
"Run time error '1004':
VB Projects and XML Sheets can not be saved in macro-free workbooks."
I would like the workbook to have the VBA coding. Does anyone know how to get around these errors?
Any help would be greatly appreciated.
Thanks,
Bob
p.s. I am using Excel 2007