Mapi32.dll

  • Thread starter Thread starter Marco
  • Start date Start date
M

Marco

I am using Mapi32.dll to send an email from an Access
application. When something goes wrong this dll gives back
a result code which is unequal to 0. Is there a way to
know what went wrong from this result code ? I could not
find a result code /description on the internet. In this
case I want to know the description in case of an error
code 14.

Regards,

Marco
 
this might help..

Private Declare Function FormatMessage Lib "Kernel32" Alias "FormatMessageA"
(ByVal dwFlags As Long, lpSource As Any, ByVal dwMessageId As Long, ByVal
dwLanguageId As Long, ByVal lpBuffer As String, ByVal nSize As Long,
Arguments As Long) As Long


Function vbString(ByVal CString As String) As String
On Error Resume Next
Dim Pos As Long
Pos = VBA.InStr(CString, Chr(0))
If Pos Then
vbString = VBA.Left(CString, Pos - 1)
Else
vbString = CString
End If
End Function

Public Function ApiError(ByVal APIErrNum As Long) As String
'Retrieves the API Error Tekst For a Error Number
Dim s As String, C As Long
Const FORMAT_MESSAGE_FROM_STRING = &H400
Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000
Const FORMAT_MESSAGE_IGNORE_INSERTS = &H200
s = CString(256)
C = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM Or _
FORMAT_MESSAGE_IGNORE_INSERTS, _
CNull, APIErrNum, ByVal 0&, s, Len(s), ByVal 0&)
If C Then ApiError = vbString(s)
End Function

HTH

Pieter
 
Back
Top