Hello Henrik,
Actually it's very simple to make a DLL with VB5 or VB6.
Just make a new project of the "ActiveX DLL" type. You will now get a new project containing only one class.
In this class you can make for example one subroutine which generates a messagebox with an error message. You can use parameters to make the message fit any error.
A short sample could be:
Give the Class module as sensible name, as you have to refer to it later (for example: clsErrorHandler).Code:Public Sub Generate_Error(Number As Long, Description As String, Source As String) MsgBox "An error occurred. Details:" & vbCrLf & "Number: " & Number & vbCrLf & "Description: " & Description & vbCrLf & "Source: " & Source End Sub
If you compile this into a DLL then you can make a reference in an EXE project (Project -> References menu) to you DLL.
Now you declare the clsErrorHandler within the new project:
Now you can call the object in each sub when an error occurs. Example:Code:Public hdErrorHandler As New clsErrorHandler
Hope this helps...Code:hdErrorHandler.Generate_Error Err.Number, Err.Description, "Error happened in sub Main"
Hajo Dijkstra




Reply With Quote