Article ID: 928283 - Last Review: October 15, 2007 - Revision: 1.2 Error message when you use a VBA macro to save a shared Excel 2007 workbook: "Application-defined or object-defined error"On This PageSYMPTOMSWhen you try to run a Microsoft Visual Basic for Applications (VBA) macro that saves the current workbook as a shared workbook in Microsoft Office Excel 2007, you receive the following error message: Run-time error '1004'
Application-defined or object-defined error. CAUSEThis issue may occur if the following conditions are true:
WORKAROUNDMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. 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.
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.
| Article Translations
|

Back to the top
