Skip to content

Email and the Redemption Library

How to email attachments using the redemption library.

Q:  Mark Riddick writes:  “Before OMG became an issue I used to email snapshots of Access reports using docmd.sendobject etc etc. How do I achieve the same thing using Redemption?  The database in question is Access 2000.”

A:  OMG (the annoying Object Model Guardian pop-up that appears when code works with the Address Book) can be suppressed using Dmitry Streblechenko’s Redemption Library, as described in Access Archon #113.  I prefer to create a new email message and add the attachment to it (rather than using SendObject, which is rather buggy).  See the Send an Access Report section of Access Archon #101 for details on this method.  To avoid the Object Model Guardian, you can create a SafeMailItem object to work with using the following code segment (modify as needed for your use):

Set omsg = gappOutlook.CreateItem(olMailItem)

Set msg = New Redemption.SafeMailItem

msg.Item = omsg

 

With msg

   .To = strToEMail

   .Subject = strMessageSubject

   .Body = strBody

   .Attachments.Add strSnapshotFile

   .Send

End With

 

Note:  Messages created with Redemption Library objects are created in the Drafts folder instead of the Outbox, but they will be sent as if from the Outbox.

About this author

Office 2024 - all you need to know. Facts & prices for the new Microsoft Office. Do you need it?

Microsoft Office upcoming support end date checklist.