XL97: Run-time Error 1004 When You Save Workbook as Text (198671)
The information in this article applies to:
- Microsoft Excel 97 for Windows
This article was previously published under Q198671 SYMPTOMS
When you run a Visual Basic for Applications macro that saves a workbook as text, you may receive the following error message:
Run-time error '1004':
Method 'SaveAs' of object '_Workbook' failed"
CAUSE
This error message occurs when the following conditions are true:
- The Lock Project for Viewing option is selected in the Visual Basic for Applications project.
-and- - You run a macro that uses the .SaveAs method and the FileFormat argument is set to xlText
WORKAROUND
To work around this problem, unlock the workbook before running the macro. To do this, follow these steps:
- Open the workbook that you are trying to save as text.
- Press ALT+F11 to open the Visual Basic Editor.
- On the Tools menu, click VBAProject Properties, and then click the Protection tab.
- Click to clear the Lock project for viewing check box. Click OK.
- On the File menu, click Save. Press ALT+Q to return to Excel.
The macro should now run properly and save the workbook as a text file.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 2/6/2001 |
---|
Keywords: | kbbug kbdtacode kberrmsg KB198671 |
---|
|