Application-defined or object-defined error.
- The default save format is set to Excel 97-2003. Additionally, a new workbook is added, and the macro uses the ProtectSharing method or the SaveAs method against the new workbook in the Excel 97-2003 file format.
- The ProtectSharing method uses the FileFormat property set to xlExcel8.
To work around this issue, use one of the following methods.
Method 1: Set the default file format to xlWorkbookNormalTo use either the ProtectSharing method or the SaveAs method in a VBA macro, set the default file format to ExcelWokbookNormal early in your VBA macro.
The following VBA code is an example of how to use the DefaultSaveFormat method to set the default file format to xlWorkbookNormal.
Application.DefaultSaveFormat = xlWorkbookNormal
- Click the Microsoft Office Button, and then click Excel Options.
- Click Save.
- In the Save files in this format box, click the format in which you want workbooks to be saved by default.
- Click OK to close the Excel Options dialog box.
Method 2: Use the SaveAs method with the AccessMode parameterTo use the SaveAs method, use the AccessMode parameter.
The following VBA code is an example of how to use the SaveAs method with the AccessMode parameter.
ActiveWorkbook.SaveAs FileName:="filename.xls", AccessMode:=xlShared, FileFormat:=xlExcel8
ID do Artigo: 928283 - Última Revisão: 15 de out de 2007 - Revisão: 1