GP Fault Using MAPI.DLL Calls in Visual Basic ProcedureLast reviewed: July 29, 1997Article ID: Q123185 |
The information in this article applies to:
SYMPTOMSIn a Microsoft Visual Basic, Applications Edition, procedure, when you call the MAPI.DLL in a Visual Basic procedure, you receive a general protection (GP) fault.
CAUSEAlthough it is possible to declare and call the Visual Basic MAPI functions from a Visual Basic procedure in Microsoft Excel or Microsoft Project, the calls usually cause a GP Fault. You cannot use MAPI functions from a Visual Basic procedure in Microsoft Excel or Microsoft Project in the form that is documented for use with Visual Basic version 3.0. NOTE: The MAPI calls that fail are the calls that use custom Type definitions (MAPIMessage, MAPIRecip, or MAPIFile). Other calls that don't use a custom Type (such as MAPILogon and MAPISendDocuments) may work correctly.
WORKAROUNDS
Microsoft ProjectTo work around this problem, you can use the VBAMAPI.DLL file that is provided with Microsoft Project. This file provides the same Visual Basic interfaces to MAPI in a form that is compatible with Visual Basic, Applications Edition. Note that you can also use the built-in mail functionality provided in Microsoft Project. For example, you can use the following in a Visual Basic procedure:
MailLogOff method MailLogOn method MailRoutingSlip method MailSend method MailSendProjectMail method MailSendScheduleNote method MailSession property MailSystem property MailUpdateProject method Microsoft ExcelTo work around this problem, use the built-in mail functionality provided in Microsoft Excel. For example, you can use the following in a Visual Basic procedure:
MailLogoff method MailLogon method MailSession property MailSystem property SendMail method MORE INFORMATIONMessaging Application Programming Interface (MAPI) is the standard programming interface proposed and supported by Microsoft for accessing electronic messaging. The following MAPI.DLL functions do not cause a GP fault when you use them in a Visual Basic, Applications Edition, procedure:
MAPILogon MAPILogoff MAPIDetails MAPISendDocuments MAPIDeleteMailYou receive a GP fault when you call any of the following MAPI.DLL functions in a Visual Basic, Applications Edition, procedure:
MAPIResolveName MAPIFindNext MAPIAddress MAPISaveMail MAPISendMail MAPIReadMailFor additional information, please see the following articles in the Microsoft Knowledge Base:
ARTICLE-ID: Q125854 TITLE : XL: Sending Mail From Microsoft Excel using VBAMAPI.DLL (Part 1) ARTICLE-ID: Q125853 TITLE : XL: Sending Mail From Microsoft Excel using VBAMAPI.DLL (Part 2) REFERENCESFor more information about the MailLogon Method or the MailLogoff Method, choose the Search button in the Visual Basic Reference (Excel) and type:
MAPI mail sessionsFor more information about the MailLogon Method, choose the Search button in the Visual Basic Reference (Project) and type:
MailLogOn |
Additional query words: gpf vba_pj.hlp
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |