Is there a way to suppress alert messages?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I keep getting unwanted alert messages like "Do you want to save changes in
this file" in Excel. Is there a way to suppress them?
 
Dan

Not in the UI, is this for use in a program you've written? If so,

Application.DisplayAlerts=False and True at the end of code

But, I repeat, if you just want to turn of the ones that pop up in Excel as
you use it, no. My experience would also say you wouldn't want to. They
may be annoying, but they have a brief 'thought stop' which may just stop
you closing a file without saving, when really you wanted too

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
www.nickhodge.co.uk
 
Nick Hodge said:
Dan

Not in the UI, is this for use in a program you've written? If so,

Application.DisplayAlerts=False and True at the end of code

But, I repeat, if you just want to turn of the ones that pop up in Excel as
you use it, no. My experience would also say you wouldn't want to. They
may be annoying, but they have a brief 'thought stop' which may just stop
you closing a file without saving, when really you wanted too

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
www.nickhodge.co.uk


Yes, I have a VB.NET program that uses Excel Automation. I used the
DisplayAlerts method to suppress these messages and for several months it
worked fine. However, suddenly I began to get run-time errors telling me
that Excel had to close and then sending an error report to Microsoft. By
setting DisplayAlerts=True everthing works OK except that I get messages
asking "Do I want to save the file..." that Excel has modifiied. I even
re-installed Office2003 from my CD, but the problem continues.
 
Dan

Have you tried re-compiling your .NET code as it looks like that is the
issue or does your code work fine on other machines?

You could code around your current example (although I feel you may be
drip-feeding us detail ;-)) by using something like

xlWb.Saved=True

This fools the workbook into believing it is 'clean' and it will not ask to
save

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
www.nickhodge.co.uk
 
I've had similar problems with wbs that were opened readonly - besure to
open with read only false and ingorereadonly set to true.
Also probs with login credentials could cause this
Failing that as Nick suggests a bit bit more code may be needed to help
further
 
Back
Top