Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Automatically overwriting files

Greetings,

I have the following VBA code which saves a text file to a certain folder.
However, if that file already exists, it displays a dialog box asking me if I
want to overwrite the existing file. I always want to answer "Yes" to this
dialog. However, I won't always know if a file by that same name already
exists before the code is run. That means that the dialog will not always
appear. I guess I could use Sendkeys, but that would only work if an
existing file by that same name would always be in that folder. Any idea as
to how to get around this?

ActiveWorkbook.SaveAs Filename:="C:\filename.txt", FileFormat:=xlText, _
CreateBackup:=False
--

Thanks in advance!
Sherwood
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Automatically overwriting files

Hi Sherwood

Before the save
Application.DisplayAlerts = False

amd after the save
Application.DisplayAlerts = True


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Sherwood" wrote in message ...
Greetings,

I have the following VBA code which saves a text file to a certain folder.
However, if that file already exists, it displays a dialog box asking me if I
want to overwrite the existing file. I always want to answer "Yes" to this
dialog. However, I won't always know if a file by that same name already
exists before the code is run. That means that the dialog will not always
appear. I guess I could use Sendkeys, but that would only work if an
existing file by that same name would always be in that folder. Any idea as
to how to get around this?

ActiveWorkbook.SaveAs Filename:="C:\filename.txt", FileFormat:=xlText, _
CreateBackup:=False
--

Thanks in advance!
Sherwood



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Automatically overwriting files

Thanks, Ron. I appreciate it.
--
Sherwood


"Ron de Bruin" wrote:

Hi Sherwood

Before the save
Application.DisplayAlerts = False

amd after the save
Application.DisplayAlerts = True


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Sherwood" wrote in message ...
Greetings,

I have the following VBA code which saves a text file to a certain folder.
However, if that file already exists, it displays a dialog box asking me if I
want to overwrite the existing file. I always want to answer "Yes" to this
dialog. However, I won't always know if a file by that same name already
exists before the code is run. That means that the dialog will not always
appear. I guess I could use Sendkeys, but that would only work if an
existing file by that same name would always be in that folder. Any idea as
to how to get around this?

ActiveWorkbook.SaveAs Filename:="C:\filename.txt", FileFormat:=xlText, _
CreateBackup:=False
--

Thanks in advance!
Sherwood




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
insert rows automatically to avoid overwriting Tushar Bhatt Excel Discussion (Misc queries) 0 November 9th 09 11:41 AM
Where do I find the files that have been automatically saved? mp Excel Discussion (Misc queries) 1 April 5th 07 04:40 AM
FILES CREATED AUTOMATICALLY WHILE SAVING Venoy Varghese P Excel Discussion (Misc queries) 0 March 30th 05 04:01 PM
Want to Unzip files automatically Hari[_3_] Excel Programming 1 January 14th 05 03:37 PM
Overwriting a file automatically using saveas in a macro Sam Excel Programming 5 May 5th 04 04:01 AM


All times are GMT +1. The time now is 10:32 AM.

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"