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

Sending Mail via VBA: error & Outlook security warning

4 views
Skip to first unread message

ltek

unread,
Jan 18, 2003, 1:47:48 AM1/18/03
to
I have the code below. It seems to work fine except that Outlook puts up a
warning for each email it ties to send. How can I get it to bypass the
warning, or only need to answer it once for each invocation of the code.

I'm using this in Excel to automate building & sending emails using info
from the worksheet.

If I create the object at the start of the code, I get a Run-time
error -2044460790 (8624010a); Automation error
the only documentation I could find was :
http://support.microsoft.com/default.aspx?scid=kb;en-us;186063
and it did not have the error code listed.

Enviro: Outlook XP, WinXP, Office XP.

Thank you for your help!


------ code in workbook module-------
Option Explicit

Dim ol, MailSendItem, olns, olMailItem
Dim today As Date
Dim emlSubj, emlBody, emlAttach
Dim emlFile, emlTrack, emlRecip
Dim emlBodyUSPS, emlBodyUPS
Dim numRows, StartingRow, LastRow As Integer
Dim i As Integer
Dim goDebug As Integer

Sub ShipNotificationEmail()

numRows = ActiveSheet.UsedRange.Rows.Count

StartingRow = 3
LastRow = numRows - StartingRow

For i = StartingRow To LastRow ' Loop through the all the
populated rows

If Range("N" & i) <> "" Then ' only send email if there is
something in the tracking number area

emlTrack = UCase(Range("N" & i).Value)
'MsgBox "Tracking is " & emlTrack
emlBody = emlBodyUPS

emlBodyUPS = "Your order has been shipped." & vbCrLf & vbCrLf & "The UPS
tracking number for this purchase is:" _
& vbCrLf & vbCrLf & emlTrack & vbCrLf & vbCrLf & "If shipped via UPS,
this number may take up to" & vbCrLf & vbCrLf & _
"12 hours to become active in their online system." & vbCrLf & vbCrLf &
_
"We do not guarantee shipping times, this is dependant" & vbCrLf &
vbCrLf & _
"on the shipping company. Please check with the specific company for
details." & vbCrLf & vbCrLf & _
"Thank you for your purchase," & vbCrLf & "Tek Recycle" & vbCrLf &
vbCrLf & _
"www.tekrecycle.com"

emlBodyUSPS = "Your order has been shipped." & vbCrLf & vbCrLf & _
"We do not guarantee shipping times, this is dependant" & vbCrLf &
vbCrLf & _
"on the US Postal Service. Please check with your local Postal location
for details." & vbCrLf & vbCrLf & _
"Thank you for your purchase," & vbCrLf & "Tek Recycle" & vbCrLf &
vbCrLf & _
"www.tekrecycle.com"
emlSubj = "eBay: Item #" & Range("B" & i).Value & " - Shipping
Notification"
emlRecip = Range("I" & i).Value

If emlTrack = "USPS" Then emlBody = emlBodyUSPS


'MsgBox "Send: " & emlRecip & vbCrLf & vbCrLf & vbCrLf & _
"Subject: " & vbCrLf & emlSubj & vbCrLf & vbCrLf & "Message Text: " & vbCrLf
& vbCrLf & emlBody

Set ol = CreateObject("Outlook.Application")
Set MailSendItem = ol.CreateItem(olMailItem)
Set olns = ol.GetNamespace("Mapi")

With MailSendItem
.To = emlRecip
.Subject = emlSubj
.Body = emlBody
' .Display
.Send
End With
End If
Next i

End Sub


Daniel Klann

unread,
Jan 18, 2003, 4:18:56 AM1/18/03
to
This is part of Outlook's security against viruses. One possible solution
is to use the Redemption DLL which circumnavigates Outlook's security and
allows you to send automated messages without any warnings.

Take a look here for more info:-

http://www.dimastr.com/redemption/

Hope that helps,
Dan


"ltek" <ltekco...@hotmail.com> wrote in message
news:#bBd71rvCHA.1960@TK2MSFTNGP11...

ltek

unread,
Jan 18, 2003, 11:00:02 AM1/18/03
to
The Redemption DLL looks good but I'd rather have the users answer the
security dialog once and then allow the code to run and send all its emails.

Any ideas?

thanks!

"Daniel Klann" <danie...@hotmail.com> wrote in message
news:#AUoOKtvCHA.2380@TK2MSFTNGP12...

Tim Zych

unread,
Jan 18, 2003, 11:14:25 AM1/18/03
to
I don't know whether that is possible, but you may want to check out
www.slipstick.com

Here is a related link:
Outlook Email Security Update
http://www.slipstick.com/outlook/esecup.htm

"ltek" <ltekco...@hotmail.com> wrote in message

news:e8YefqwvCHA.2544@TK2MSFTNGP11...

ltek

unread,
Jan 18, 2003, 12:53:45 PM1/18/03
to
Also, the redemption DLL does not fix the Automation Error I'm seeing.

Can anyone help me fix that first before I try using the Redemption DLL.

thanks!


"ltek" <ltekco...@hotmail.com> wrote in message

news:e8YefqwvCHA.2544@TK2MSFTNGP11...

Sue Mosher [MVP]

unread,
Jan 19, 2003, 8:52:53 PM1/19/03
to
Not possible. The dialog will appear for each Send statement. I agree with Daniel that Redemption is the best VB/VBA solution.


"ltek" <ltekco...@hotmail.com> wrote in message news:e8YefqwvCHA.2544@TK2MSFTNGP11...

0 new messages