roopalidoshi
MIS
Hi,
I want to send email from excel macro. I have registered MSMAPI32.ocx and have included the MAPI in components. I dont have any form but there is some calucation on the excel which will trigger this email alert to production person. When it goes to first line mapisession1.signon, it gives me "Run Time Error 404 : Object required". Do you have any idea that why else do I need to declare or include?
.......................................................
Sub email_send()
mapisession1.SignOn
With MAPIMessages1
.SessionID = mapisession1.SessionID
.Compose
.MsgSubject = "Subject"
.MsgNoteText = "Message text."
.RecipAddress = "x.y@company.com"
.Send False
End With
mapisession1.SignOff
End Sub
.............................................
Since above code was not working, so I tried with other code. The below code works fine but it gives dialog box asking that somebody is trying to send email behalf of me, do you want to send yes/no. Any idea how do stop this dialog box as this is going to batch process.
-----------------------------------------
Sub mail_alert()
Dim App
Dim itm
Set App = CreateObject("Outlook.Application")
Set itm = App.CreateItem(0)
With itm
.subject = "Test Cube Validation"
.To = "x.y@company.com"
.Body = "This mail is automatically alert for validation"
.Send False
End With
Set App = Nothing
Set itm = Nothing
End Sub
--------------------------------------
Thanks,
Roopali
I want to send email from excel macro. I have registered MSMAPI32.ocx and have included the MAPI in components. I dont have any form but there is some calucation on the excel which will trigger this email alert to production person. When it goes to first line mapisession1.signon, it gives me "Run Time Error 404 : Object required". Do you have any idea that why else do I need to declare or include?
.......................................................
Sub email_send()
mapisession1.SignOn
With MAPIMessages1
.SessionID = mapisession1.SessionID
.Compose
.MsgSubject = "Subject"
.MsgNoteText = "Message text."
.RecipAddress = "x.y@company.com"
.Send False
End With
mapisession1.SignOff
End Sub
.............................................
Since above code was not working, so I tried with other code. The below code works fine but it gives dialog box asking that somebody is trying to send email behalf of me, do you want to send yes/no. Any idea how do stop this dialog box as this is going to batch process.
-----------------------------------------
Sub mail_alert()
Dim App
Dim itm
Set App = CreateObject("Outlook.Application")
Set itm = App.CreateItem(0)
With itm
.subject = "Test Cube Validation"
.To = "x.y@company.com"
.Body = "This mail is automatically alert for validation"
.Send False
End With
Set App = Nothing
Set itm = Nothing
End Sub
--------------------------------------
Thanks,
Roopali