Update on what has happened.
I created another module in Access (WLM32in64) because I have to hard code
the folder in the function
Declare Function MAPISendMail Lib "c:\program files (x86)\windows
live\mail\smapi.dll" ( _
ByVal Session As Long, _
ByVal UIParam As Long, _
Message As MAPIMessage, _
ByVal Flags As Long, _
ByVal Reserved As Long) As Long
When I did this it works.
What I have learned...
1) the function must be called MAPISendMail.
2) in Windows 7 the first and second attempt to send an email fail, the
third attempt succeeds. This happens only on the first attempt to send an
email with windows live mail and the MAPISendMail function. I have no idea
Code to make sending mail work for the very first email sent.
If MAPIError then
if MAPIError then
MAPISendMail - the email is sent on the third attempt.
What's strange is this, in Vista MAPISendMail has to try twice and in
Windows XP it works every time on the first attempt.
Remember, this is for the very first email being sent from MS Access upon
opening of the MS Access program. Once the first email attempt is complete,
every email after that works on the first attempt. No need to try two or
three times. That's just plain weird to me. But heck it works.
I hope this helps someone else.
If there is a better way to do this, I am very interested.