SaveAs Error

S

Steven K

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.
 
T

Tom Ogilvy

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top