Override existing file without prompting

C

catlair

Hi,

Wish to override an existing file when I run this macro without being
prompted to confirm the override.

Workbooks.Add

ActiveWorkbook.SaveAs Filename:= _
"Macintosh:Users:home:Documents:countries.xls",
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False,
_
CreateBackup:=False

If XX.Name <> ThisWorkbook.Name Then XX.Save ==> THIS DOES NOT
WORK. AM TRYING TO OPEN A NEW FILE AND SAVE IT UNDER A NAME THAT
ALREADY EXIST. ONLY ISSUE IS THAT I HAVE TO CONFIRM IF I WISH TO
OVERRIDE THE EXISTING FILE NAME. IS THERE A WAY TO OVERRIDE THE
EXISTING FILE NAME WITHOUT HAVING TO CONFIRM THE REQUEST?

catlair
 
K

Ken Johnson

Hi catlair,

Does it work if you include...

Application.DisplayAlerts = False

in the code?

Ken Johnson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top