Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

.attachment.add not working - Email to outlook from access

2 views
Skip to first unread message

vav...@gmail.com

unread,
Feb 23, 2006, 4:41:25 PM2/23/06
to
Hello all,

I hope you can assist.

I found a snipet of code on this group to send email from Access, using
Redemption to get around the Outlook security warnings. All works
well, except for attaching a file.

I select the file to attach via a dialogue box, which loads the full
path of the file to attach in txtPath.

Here's my variation on the code, could anyone explain why it won't
attach the files? And what I need to do to fix it?

Private Sub cmdAEGScience_Click()

Dim safemail As Variant
Dim myOlApp
Dim MyItem
Dim myRecipient
Dim myBody
Dim myfolder
Dim mynamespace
Dim myAttachments
Dim Utils
Dim strSendTo As String
Dim strCC As String
Dim strAttachPath As String
Dim strAttachPath2 As String
Dim AEGs As String

AEGs = "bla bla bla"

strSendTo = Me.cmbPaperCoord
strCC = Me.txtAddy & "@domain.com"
strAttachPath = Me.txtPath
'strAttachPath2 = "FullPathToFile"

Set myOlApp = CreateObject("Outlook.Application")
Set MyItem = myOlApp.CreateItem(0)
Set safemail = CreateObject("Redemption.SafeMailItem")
Set safemail.Item = MyItem
Set mynamespace = myOlApp.GetNamespace("MAPI")
'mynamespace.Logon "myProfile", "myPassword", True, True ' Choose a
Profile
Set myfolder = mynamespace.GetDefaultFolder(5)
With safemail
.Recipients.Add (strSendTo) ' Send To
.CC = strCC ' Carbon Copy
.Attachments.Add (strAttachPath) ' Attachment 1
'.Attachments.Add (strAttachPath2) ' Attachment 2
.Subject = "AEG - " & Me.txtStuLName & " - " & Me.txtStuID ' Email
Subject Text here
.Body = AEGs ' Text for Email Body
'.Importance = olImportanceHigh ' High importance
'.ReadReceiptRequested = True
.OriginatorDeliveryReportRequested = True
.Display
'.Send
End With

Set Utils = CreateObject("Redemption.MAPIUtils")
Utils.DeliverNow

Set myOlApp = Nothing
Set safemail = Nothing
Set Utils = Nothing
'MsgBox "Mail Sent", vbInformation, "Mail Sent..."

End Sub

Larry Daugherty

unread,
Feb 24, 2006, 2:05:57 AM2/24/06
to
I did something using Redemption a year or two back and had something
I don't see in your code:

Dim objOutlookAttach As Outlook.Attachment

Later in my code this object got repeatedly Set with vile names via
the Attachment.Add

I didn't analyze your code so don's know if you're using the same or
different version, etc.

HTH
--
-Larry-
--

<vav...@gmail.com> wrote in message
news:1140730885.8...@e56g2000cwe.googlegroups.com...

vav...@gmail.com

unread,
Feb 26, 2006, 6:39:45 PM2/26/06
to
Larry, thanks for the response. I played around a little bit with the
"missing" statement. Either it's not necessary, or I'm too ignorant
about VB to make it work. Likely, the second option is the right one
;)

Still not working, and it's a PITA :(

vav...@gmail.com

unread,
Feb 26, 2006, 8:39:33 PM2/26/06
to
Interesting. Further testing indicates that the file *does* get
attached, although it doesn't appear listed in the attachments area of
the email.

So, the problem is not attaching the file, but making sure that the
attachment gets displayed in the message. I think at this point it's
not an Access issue, but an Outlook issue... I shall go and ask there.

Thanks

0 new messages