Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Project won't save to new workbook

Status
Not open for further replies.

mcelligott

Programmer
Apr 17, 2002
135
US
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
 
Hi,

I'm not in 2007 now, but don't you have to save as an .xlsm workbook WITH macros???

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Please correct me if I'm wrong. My understanding was that older versions of excel do not support the .xlsm extension (only .xls) and I was attempting to account for older versions using this workbook. I probably should have mentioned that too.

Bob
 
So, say to the SaveAs method that you want to create an older version ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top