Saving a workbook with VBA.....

KnooKie
11-01-2004, 05:25 AM
i am wanting to save a workbook which i can do fine but the part i am having trouble with is if the workbook already exists. If it does exist i want to overwrite it without the popup 'Do you want to overwrite' message coming up.

i thought the following might work but the popup still seems to appear.....


Set xlWb = XLapp.Workbooks.Add
xlWb.SaveAs FileName:=FileLocation & DirName & (Left(DirName, Len(DirName) - 1)), ConflictResolution:=xlLocalSessionChanges


any ideas please

Greychild
11-01-2004, 06:07 AM
What you need is


Application.DisplayAlerts = False
'Code to save file
Application.DisplayAlerts = True


Don't forget to set the DisplayAlerts back to true, or you won't get warning messages prompting you to save Excel files as you close them. That can be VERY annoying, as a lot of people rely on that message.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum