What do you do when DisplayAlert does not work in VBA?

M

M. Hussaini

I have an Excel workbook that is created using VBA. I have set DisplayAlert
to False just before I save the Workbook. This does not seem to work as, the
Save Dialog Box keeps coming up. I do not want this because I want to
automate the whole process. Any suggestions?
 
R

Ron de Bruin

Hi M. Hussaini

If you want to close the file after you save with VBA and not want to see Save Dialog Box
Then you can use this with code

ActiveWorkbook.Close False

If you have set a reference (WB ) to the file you can de
WB.Close False
 
G

Gord Dibben

Are you using this line? Application.DisplayAlerts = False

DisplayAlerts by itself does nothing.

You can also use this method with no message.

ActiveWorkbook.Close SaveChanges:=True


Gord Dibben MS Excel MVP
 
J

Jon Peltier

The first time you save the workbook, it needs a path and filename. Use
SaveAs instead of Save, and provide a full name. This should avoid the Save
As dialog popping up.

- Jon
 
Top