I was searching thru the MSDN, and I happened to stumble upon a section called
"Turning API Errors into Basic Errors" from Bruce McKinney's Hardcore VB
book. In it, he demonstrates how errors from API calls can be raised to
calling routines via the Err.Raise method (example code follows). I was
wondering how many people follow this strategy and how often. Usually I
don't expect an API to fail so I rarely even check return values, let alone
raise them back as errors to the calling routines. This method has always
worked for me but now that I think about, it seems kind of foolish of me
to ignore return values. On the other hand, I honestly cannot think of any
situation where this lack of error handling has hurt me.

- Jim

c = GetTempPath(cMaxPath, sRet)
If c = 0 Then ApiRaise Err.LastDllError

Sub ApiRaise(ByVal e As Long)
Err.Raise vbObjectError + 29000 + e, _
App.ExeName & “.Windows”, ApiError(e)
End Sub

Function ApiError(ByVal e As Long) As String
Dim s As String, c As Long
s = String(256, 0)
c = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM Or _
FORMAT_MESSAGE_IGNORE_INSERTS, _
pNull, e, 0&, s, Len(s), ByVal pNull)
If c Then ApiError = Left$(s, c)
End Function