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 |
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 |
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 |
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 . |
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 . |
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 . |
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 . |
All times are GMT +1. The time now is 11:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com