Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA Save As

I have some code that saves a file with a set name and
path using the ActiveWorkbook.SaveAs method. When the file
already exists, the user is prompted about whether to
write over the file. If the user answers 'No' or 'Cancel',
an error (#1004) occurs. My error handler hasn't been able
to trap this error for some reason. Is there a quick way
to get Excel to prompt for another file name and then
continue processing the remaining code? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Excel VBA Save As

Hi

You could use

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs ("Test saveas.xls")

Application.DisplayAlerts = True

which will force an overwrite. If you don't want to do that for fear of
overwriting a different existing file, you could use

Excel.Application.Dialogs(xlDialogSaveAs).Show

where you can change the saveas name or cancel without the error.



HTH



KenM


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Suddenly Save and Save as greyed out in Excel 2003 Pavitra Excel Discussion (Misc queries) 0 March 22nd 10 08:01 AM
Save, save as, page setup dimmed out in unprotected excel sheet? ccKeithJ Excel Discussion (Misc queries) 3 December 14th 07 07:07 PM
'document not saved' for 'save' or 'save as' an EXCEL file Judy Chuang Excel Discussion (Misc queries) 1 July 11th 05 10:12 PM
Save & Save As features in file menu of Excel Blue Excel Discussion (Misc queries) 9 December 27th 04 08:49 PM
Save Excel file - prompts to save - no Volitile functions used POWER CERTS Excel Worksheet Functions 2 November 1st 04 09:27 PM


All times are GMT +1. The time now is 01:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"