IN THE SPOTLIGHT: MDE to MDB Conversion Service
(also supports: ACCDE to ACCDB, ADE to ADP, etc)
IN THE SPOTLIGHT: vbWatchdog
VBA error handling just got easier...
" vbWatchdog is off the chart. It solves a long standing problem of how to consolidate error handling into one global location and avoid repetitious code within applications. "
- Joe Anderson,
Microsoft Access MVP
Meet Shady, the vbWatchdog mascot watching over your VBA code →
(courtesy of Crystal Long, Microsoft Access MVP)
IN THE SPOTLIGHT: vbMAPI
An Outlook / MAPI code library for VBA, .NET and C# projects
Get emails out to your customers reliably, and without hassle, every single time.
Use vbMAPI alongside Microsoft Outlook to add professional emailing capabilities to your projects.
To add vbWatchdog to your project, you need to add the vbWatchdog class modules into your application. You do this by using the vbWatchdog developer Addin that is provided. If you haven't yet installed the vbWatchdog developer AddIn, then you can get it in the Downloads section. Registered users: use the download link in your receipt e-mail!
To use the addin, simply locate the "Addins" menu in the Visual Basic environment, choose "vbWatchdog", and then select "Add vbWatchdog to this project". Now you should find that you've got four ErrEx class modules added to your project.
To use vbWatchdog in a VB6 project requires that you to create a class module that will expose a member that gets called when an exception is detected.
You then simply set the ErrEx.EvalObject property to an instance of that class, and call the ErrEx.Enable method with the name of the member that you want to be called on error.
Sub Main() Set ErrEx.EvalObject = New MyGlobalErrorHandler ErrEx.Enable "OnError" SimulateAnError End Sub Public Sub SimulateAnError() MsgBox 1 / 0 ' enforce a division by zero error for testing End Sub
In a class called MyGlobalErrorHandler:
Public Sub OnError() LogErrorToFile End Sub Public Sub LogErrorToFile() Dim FilePath As String Dim FileNum As Long Dim LogLine As String On Error Resume Next ' If this procedure fails, something fairly major has gone wrong. ' We will write to a simple text file called SampleErrorLog in our MyDocuments folder FilePath = CreateObject("WScript.Shell").SpecialFolders("MYDOCUMENTS") & "\SampleErrorLog.txt" ' If you're new to vbWatchdog, don't worry about what follows just yet. ' It is basically iterating through the call stack to get more details about the error. FileNum = FreeFile Open FilePath For Append Access Write Lock Write As FileNum Print #FileNum, Now() & " - " & CStr(ErrEx.Number) & " - " & CStr(ErrEx.Description) 'We will separate the call stack onto separate lines in the log With ErrEx.CallStack Do Print #FileNum, " --> " & .ProjectName & "." & _ .ModuleName & "." & _ .ProcedureName & ", " & _ "#" & .LineNumber & ", " & _ .LineCode & vbCrLf Loop While .NextLevel End With Close FileNum End Sub