Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Say 'YES' to overwrite file

Dear Guru's and Experts:

I'm sure this is a simple one for you.

I want my script to automatically reply "YES" when
prompted if I wish to overwrite a file.

My existing coding is ...
'Save the file
ActiveWorkbook.SaveAs Filename:=fsn

Your guidance and help is appreciated and gives me more
knowledge.

Best regards, Mike


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Say 'YES' to overwrite file

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=fsn
Application.DisplayAlerts = True

--
Regards,
Tom Ogilvy

"Mike G." wrote in message
...
Dear Guru's and Experts:

I'm sure this is a simple one for you.

I want my script to automatically reply "YES" when
prompted if I wish to overwrite a file.

My existing coding is ...
'Save the file
ActiveWorkbook.SaveAs Filename:=fsn

Your guidance and help is appreciated and gives me more
knowledge.

Best regards, Mike




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Say 'YES' to overwrite file

"Mike G." skrev i melding
...
I want my script to automatically reply "YES" when
prompted if I wish to overwrite a file.


No, you don't want the question there in the first place:

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=fsn
Application.DisplayAlerts = True

HTH. Best wishes Harald


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Say 'YES' to overwrite file

Thanks
-----Original Message-----
"Mike G." skrev i melding
...
I want my script to automatically reply "YES" when
prompted if I wish to overwrite a file.


No, you don't want the question there in the first place:

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=fsn
Application.DisplayAlerts = True

HTH. Best wishes Harald


.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Say 'YES' to overwrite file

Thanks
-----Original Message-----
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:=fsn
Application.DisplayAlerts = True

--
Regards,
Tom Ogilvy

"Mike G." wrote in message
...
Dear Guru's and Experts:

I'm sure this is a simple one for you.

I want my script to automatically reply "YES" when
prompted if I wish to overwrite a file.

My existing coding is ...
'Save the file
ActiveWorkbook.SaveAs Filename:=fsn

Your guidance and help is appreciated and gives me more
knowledge.

Best regards, Mike




.



  #6   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default Say 'YES' to overwrite file

While the Guru's and Experts are pondering this one, I can
offer a suggestion. Get the name of the file to save as,
delete it if it exists, then save yours. Like this:

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("C:\MyFiles\")
For Each file In f.Files
If file.Name = "fsn" Then
fso.DeleteFile "C:\MyFiles\fsn"
End If
Next file


-----Original Message-----
Dear Guru's and Experts:

I'm sure this is a simple one for you.

I want my script to automatically reply "YES" when
prompted if I wish to overwrite a file.

My existing coding is ...
'Save the file
ActiveWorkbook.SaveAs Filename:=fsn

Your guidance and help is appreciated and gives me more
knowledge.

Best regards, Mike


.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Say 'YES' to overwrite file

Easier would be

On Error Resume Next
Kill "C:\MyFiles\fsn"
On Error goto 0

--
Regards,
Tom Ogilvy

"Tod" wrote in message
...
While the Guru's and Experts are pondering this one, I can
offer a suggestion. Get the name of the file to save as,
delete it if it exists, then save yours. Like this:

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("C:\MyFiles\")
For Each file In f.Files
If file.Name = "fsn" Then
fso.DeleteFile "C:\MyFiles\fsn"
End If
Next file


-----Original Message-----
Dear Guru's and Experts:

I'm sure this is a simple one for you.

I want my script to automatically reply "YES" when
prompted if I wish to overwrite a file.

My existing coding is ...
'Save the file
ActiveWorkbook.SaveAs Filename:=fsn

Your guidance and help is appreciated and gives me more
knowledge.

Best regards, Mike


.



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
Excel File Overwrite GradAsh10 Excel Discussion (Misc queries) 1 January 18th 10 04:13 PM
accidental file overwrite drumjam Excel Discussion (Misc queries) 1 December 31st 08 07:37 AM
VBA to automatically test for file, update, overwrite Brent E Excel Discussion (Misc queries) 3 October 22nd 08 11:00 PM
retrieving of overwrite excel file? PLS! need help. Excel Discussion (Misc queries) 1 October 10th 05 10:34 AM
how to overwrite a write reserved file? john_t_h[_13_] Excel Programming 0 January 15th 04 05:13 AM


All times are GMT +1. The time now is 02:37 PM.

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

About Us

"It's about Microsoft Excel"