Hello all....I have simple code that is used by other users. I would like to have a custom MsgBox appear if an error occurs that would help the user to let me know where the error occured but then continue on without stopping the code.

I know this is not preferred in most cases but in my situation, not running the code causing the errors is better than stopping the entire process.

What I would like is code something like this but I am not sure if this will work and not sure how to test error code realtime. I also would like to be able to customize the msgbox to show a different message at different points in the code.

[VBA]

On Error Resume Next
MsgBox "Error when trying to _________"
'continue on with code at point error occurred

[/VBA]

So...what is the correct format for this example and can I repeat it with differing messages later in the code ?

Thanks in advance.