Calling Error Handling in VBA

P

pcm1977

I found code that Allen Browne created to capture errors into a table.

http://allenbrowne.com/ser-23a.html

The issue I have is how to call it? What do i put in my code at line "3" below to call this Public Function?


From Allen Browne's Web Site

1 Sub|Function SomeName()
2 On Error GoTo Err_SomeName ' Initialize error handling.

3 ' Code to do something here. ' THIS WHAT I CANNOT FIGURE OUT

4 Exit_SomeName: ' Label to resume after error.
5 Exit Sub|Function ' Exit before error handler.
6 Err_SomeName: ' Label to jump to on error.
7 MsgBox Err.Number & Err.Description ' Place error handling here.
8 Resume Exit_SomeName ' Pick up again and quit.
9 End Sub|Function

I have tried:

"Call LogError" = Error Message "Compile Error: Argument not optional"
"LogError" = Error Message "Compile Error: Argument not optional"
"LogError() = "Compile Error: Expected ="
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top