Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel File Overwrite | Excel Discussion (Misc queries) | |||
accidental file overwrite | Excel Discussion (Misc queries) | |||
VBA to automatically test for file, update, overwrite | Excel Discussion (Misc queries) | |||
retrieving of overwrite excel file? | Excel Discussion (Misc queries) | |||
how to overwrite a write reserved file? | Excel Programming |