[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Re: GetSaveAsFileName to prompt for overwriting?

Jon Peltier

12/13/2006 3:26:00 AM

Alternatively, put the GetSaveAsFileName inside a Do Loop. When the user
inputs a file name, do Dir() or the equivalent to see if the file exists. If
so, offer the choice of overwriting (in which case you exit the loop) or
trying to enter an unused name; if not, exit the loop.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://Pelti...
_______


"Jim Thomlinson" <James_Thomlinson@owfg-Re-Move-This-.com> wrote in message
news:1D30AF84-80B2-41B4-BDA3-5906971411C8@microsoft.com...
> Why not just use the SaveAs dialog then?
>
> Application.Dialogs(xlDialogSaveAs).Show "MyFile.xls"
> --
> HTH...
>
> Jim Thomlinson
>
>
> "simonc" wrote:
>
>> GetSaveAsFileName only returns the path where you want to write the file,
>> without any checking or actual saving. How do you code a check that if
>> this
>> file already exists it asks if you want to overwrite it or not, and, if
>> you
>> decide not, would keep the GetSaveAsFileName dialog open so you can type
>> in a
>> new file name? (ie, exactly the behaviour you get when you use SaveAs in
>> Microsoft Excel).
>>
>> Grateful for any help.