none
Win 8.1 error on .body RRS feed

  • Question

  • I have a procedure in Microsoft Access that creates an email in Outlook using late-binding. This procedure has worked in all versions of Access from 97 to 2013 and Windows from XP to Windows 8. I upgraded to Windows8.1 and am now getting an error at the .body line:

    Set objOutlookMsg = objOutlook.CreateItem(0) 'olMailItem
    TheAddress = MyRS![Email]
    With objOutlookMsg
        ' Add the To recipients to the e-mail message.
         Set objOutlookRecip = .Recipients.Add(TheAddress)
         objOutlookRecip.Type = 1      'olTo
        ' Set the Subject, the Body, and the Importance of the e-mail message.
         .Subject = MyRS!Name & " confirmation, " & strDates
         .Body = Form_fdlgSendEmail.txtBody

    Returns Error #-2147417851 Method 'Body' of object '_Mailitem' failed.

    If I step through the code, the error occurs at the .Body = Form_fdlgSendEmail.txt body line and says:

    Error #-214717851 Automation error. The server threw an exception.

    The version of Office was not changed. Only change is the Win 8.1 update.   I've reinstalled Win 8 and it works normally.  Re-installed Win8.1 and it does not work.

    Is there a fix for this?   I use this sub quite a bit and need it to work.

    Saturday, August 23, 2014 12:47 AM

Answers

  • I found the problem.

    The code is seeing the value of fdlgSendEmail.txtBody but does not want to assign it to .body.

    I changed the code to

         strBody = form_fdlgSendEmail.txtBody
         .body = strBody

    and it works now.

    Saturday, August 23, 2014 6:15 PM

All replies

  • Try to set the HTMLBody property. Do you get the same error in that case?

    What value do you try to set to the Body property?

    Saturday, August 23, 2014 6:04 AM
  • I get the same error with HTMLBody, except it says  HTMLBody  instead of  Body  in the error message.

    I'm assigning the value of txtBody from the open form  fdlgSendEmail.

    While I'm testing, the value (default) of txtBody is "Letter attached."

    (This sub creates a pdf of an individualized letter and attaches it to the email.  The error is occuring on the .body line, prior to the creation of the letter.)

    Saturday, August 23, 2014 4:33 PM
  • I will try to reproduce the issue on my machine with Windows 8.1 and Office 2013 installed (both are x64) and let you know the results.
    Saturday, August 23, 2014 5:02 PM
  • I found the problem.

    The code is seeing the value of fdlgSendEmail.txtBody but does not want to assign it to .body.

    I changed the code to

         strBody = form_fdlgSendEmail.txtBody
         .body = strBody

    and it works now.

    Saturday, August 23, 2014 6:15 PM
  • Good news! Thank you for letting us know the results.
    Sunday, August 24, 2014 6:36 AM