Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Email 2 - problem in Outlook 2000 1

Status
Not open for further replies.

pradipto

Programmer
Apr 29, 2002
22
US
Hi,

I am basically trying to run this macro (below) in VBA. It used to work alright in Outlook 97, but in Outlook 2000 another pop-up opens up saying that "A program is trying to automatically send e-mail on your behalf. Do you want to allow this?" etc and this pop-up has three buttons - "Yes/No/Help" and the code below doesn't work if we don't click "Yes". I tried Sendkeys to send both "y" and Alt-y and it still doesn't work. Please help.

Pradipto

-------------------------------------------------
Sub sendmessage()
Dim Olook As Object 'outlook.application
Dim Mitem As Object 'outlook.mailitem
Dim fname As String
Set Olook = CreateObject("Outlook.Application")
Set Mitem = Olook.createitem(0)

fname = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name

Mitem.to = "hereistheemail@myemail.com"
Mitem.Subject = "Here is the subject"
Mitem.body = "Here is the body"
Mitem.Attachments.Add fname
Mitem.send
Set Olook = Nothing
Set Mitem = Nothing
End Sub
-------------------------------------------------
 
Thank you so much. It really worked. Really don't know how to thank you. So many of my office automatic mailing applications had stopped working because of Outlook 2000. Here is the modified code that I used (keeping it here so that any other person who may read this page, can find it useful).


Sub sendmessage2()
Dim Olook As Object 'outlook.application
Dim Mitem As Object 'outlook.mailitem
Dim Mitem2 As Object
Dim fname As String
Set Olook = CreateObject("Outlook.Application")
Set Mitem = CreateObject("Redemption.SafeMailItem")
Set Mitem2 = Olook.CreateItem(0)
Mitem.Item = Mitem2

fname = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name

Mitem.Recipients.Add "hereistheemail@myemail.com"
Mitem.Recipients.ResolveAll
Mitem.Subject = "Here is the subject"
Mitem.body = "Here is the body"
Mitem.Attachments.Add fname
Mitem.send
Set Olook = Nothing
Set Mitem = Nothing
End Sub
 
Jon,
Well, the above code worked well the first time. The second time onwards, it seems to get stuck in the Drafts folder. The Redemption website mentions a solution (under the FAQ section) to use

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

I tried that too, but it doesn't work. Any thoughts?
 
As I mention in the FAQ, I havent actually implemented Redemption yet. I'd recommend you email their support dept. Jon Hawkins
 
pradipto or jonscott8,

Did either of you come up with a solution for the error on the second send?

Thanks [afro]ZeroAnarchy
Experience is a wonderful thing. It enables you to recognize a mistake
when you make it again.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top