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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MAPI object not identified

Status
Not open for further replies.
Jun 21, 2004
11
US
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
 
Hello roopalidoshi,

If you use mapi.session, should you not use, instead of signon and signoff?
mapisession1.logon
mapisession1.logoff

regards - tsuji
 
For your first code segment you need to add a MAPImessage control and a MAPIsession control to your worksheet. You are correct about using Signon for the MAPIsession control.

The first method uses your default MAPI client to send the message. If that default is Outlook, then the second method is essentially using the same transport mechanism, but is loading full Outlook to do it (unnecessarily).

The dialog box will pop up using either of those methods after an Outlook security patch issued last year to prevent your machine being used for spam generation. One way of avoiding this is to use Outlook Redemption from:


The alternative is to use vbSendMail from:


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top