Auto Accept Error Message

Auto Accept Error Message

machiel.veldkamp
Collaborator Collaborator
378 Views
2 Replies
Message 1 of 3

Auto Accept Error Message

machiel.veldkamp
Collaborator
Collaborator

Is there a way to auto accept error messages? 

 

I've looked at the EventManager and the UsedInterfaceEvents but I only see how to make new events and not how to modify  (or auto accept) existing events. 

 

 

Any thoughts?

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
379 Views
2 Replies
Replies (2)
Message 2 of 3

Owner2229
Advisor
Advisor

Hey, it depends on what's the source of these messages.

E.g. If it's something from your code (e.g. a rule), you can simply use this:

 

ThisApplication.SilentOperation = True

'Your code

ThisApplication.SilentOperation = False
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes
Message 3 of 3

AlexFielder
Advisor
Advisor

Hi @machiel.veldkamp,

 

In theory, you *should* be able to run a rule such as this:

 

Sub Main()
Try
	'Do something here that might cause one of the following:
Catch ArgEx As ArgumentException
	MessageBox.Show("Caught an Argument Exception: " & ArgEx.Message, "Title")
Catch ComEx As COMException
	MessageBox.Show(Caught a COM Exception: " & ComEx.Message, "Title")
Catch Ex As Exception
	MessageBox.Show("Caught a general Exception: " & Ex.Message, "Title")
End Try

End Sub

The reality is that unless you tick the "Straight VB Code" button here:

 

2017-03-31 13_16_04-Edit Rule_ TryCatchCatch.png

iLogic complains that: 

 

2017-03-31 13_17_08-Rule Compile Errors in TryCatchCatch, in TryCatchCatch.iLogicVb.png

 

Which doesn't help much.

 

I assume this is because iLogic only accepts the one Try Catch End Try...?

 

I guess you could just use a generic "Try Catch" and check the type of Exception:

 

Try

'do something here

Catch ex As Exception
	' Single catch block - catches as generic system exception
			'Process as FaultEx
	If TypeOf ex Is FaultException Then

	End If
			'Process as ArithEx
	If TypeOf ex Is ArithmeticException Then

	End If
			'Process as ArgEx
	If TypeOf ex Is ArgumentException Then

	End If
		'Cleanup
Finally

End Try

This way you can, as you put it "Auto Accept" certain Exception types and catch the rest.

 

Regards,

 

Alex.

0 Likes