Excel Application Warinings and Errors

  • Thread starter Thread starter PPL
  • Start date Start date
P

PPL

Hi I'm trying to treat an Excel warning through VBA. Can this be done?
Excel Application errors or warnings don't seem to raise error codes in VBA
TIA
Phil
 
Most warnings can be suppressed by turning off alerts:

Application.DisplayAlerts = False
' your code here
Application.DisplayAlerts = True

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
 
Hi Chip,
Thanks for that.
I want to be able to trap the warning with an error/warning code
If Err# = 1234
Then
Do something
End If

Of course this approach is totally doable with VBA errors, but can I trap
application warings/alerts through Event handling for example?

Thanks

Phil
 
There is no way to trap error/warning messages generated by Excel. You
can turn them off with DisplayAlerts, but there is no way to deal with
them programmatically.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top