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"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
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
-------------------------------------------------
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
-------------------------------------------------