Hello
I have finished writing my code.
After hitting a command button, it will select all visible sheets except two that I specified; and will create a new workbook with those selected sheets.
Now, in that new workbook, when I try to save it; I get an error saying:
" The following features cannot be saved in macro-free workbooks: 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"
1) If I click "yes" I get an another error " Errors were detected while saving the file. Microsoft Excel may able to save the file be removing some features. To make repairs click continue. To cancel click cancel"
2) If I click "No", It will force me to chose a file type. After trial and error, I found out that "Excel 97-2003.xls" is the type that lets it save.
My question; what is a workaround to avoid all this mess. I just want the user to be able to save it right away.
Maybe force the VBA to create the new workbook in that specific file type? Or maybe create the new workbook with no Macros?
Appreciate your help
Thanks
I have finished writing my code.
After hitting a command button, it will select all visible sheets except two that I specified; and will create a new workbook with those selected sheets.
Now, in that new workbook, when I try to save it; I get an error saying:
" The following features cannot be saved in macro-free workbooks: 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"
1) If I click "yes" I get an another error " Errors were detected while saving the file. Microsoft Excel may able to save the file be removing some features. To make repairs click continue. To cancel click cancel"
2) If I click "No", It will force me to chose a file type. After trial and error, I found out that "Excel 97-2003.xls" is the type that lets it save.
My question; what is a workaround to avoid all this mess. I just want the user to be able to save it right away.
Maybe force the VBA to create the new workbook in that specific file type? Or maybe create the new workbook with no Macros?
Appreciate your help
Thanks
Code:
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim wkb As Workbook
Set wkb = ActiveWorkbook
For Each ws In Sheets
If ws.Name = "Start" Then ws.Visible = False
If ws.Name = "Revision Log" Then ws.Visible = False
If ws.Visible Then ws.Select (False)
Next
ActiveWorkbook.Sheets.Copy
wkb.Close False
End Sub