ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SaveAs Error (https://www.excelbanter.com/excel-programming/310324-saveas-error.html)

Steven K

SaveAs Error
 
Hello,

I am getting the following error when trying to save a file as a CSV file:

run-time error '1004': Method 'SaveAs" of object'_Workbook' failed

I found the following workaround (see below), but I am building this
application for other people and this solution is not an option.

Any help with this would be appreciated.

--
Thanks in advance,

Steven


http://www.kbalertz.com/kb_Q199268.aspx
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.



Tom Ogilvy

SaveAs Error
 
Activesheet.copy
Application.DisplayAlerts = False
Activeworkbook.Saveas "C:\MyFile.csv"
Application.DisplayAlerts = True
ActiveWorkbook.Close Savechanges:=False

--
Regards,
Tom Ogilvy

"Steven K" wrote in message
...
Hello,

I am getting the following error when trying to save a file as a CSV file:

run-time error '1004': Method 'SaveAs" of object'_Workbook' failed

I found the following workaround (see below), but I am building this
application for other people and this solution is not an option.

Any help with this would be appreciated.

--
Thanks in advance,

Steven


http://www.kbalertz.com/kb_Q199268.aspx
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.






All times are GMT +1. The time now is 10:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com