You can't create an Outlook MailItem by using the New directive. Instead
you create the object by working through the Outlook hierarchy. For
example, the following would be correct if using the Outlook Object model.
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
myItem.Attachments.Add "C:\TPTrades20000713.txt"
myItem.Send
And since you specified CDO in your subject...
' objSession is a valid MAPI.Session object
Set objNewMsg = objSession.Outbox.Messages.Add
' verify objNewMsg created successfully ... then supply properties
Set objSenderAE = objOriginalMsg.Sender ' sender as AddressEntry
With objNewMsg
.Text = "How about a slightly used bicycle?" ' new text
.Subject = objOriginalMsg.Subject ' copy original properties
.ConversationTopic = objOriginalMsg.ConversationTopic
' append time stamp; compatible with Microsoft Exchange client
Set objOneRecip = .Recipients.Add( _
Name:=objSenderAE.Name, _
Address:=objSenderAE.Type & ":" & objSenderAE.Address, _
Type:=CdoTo)
.Recipients.Resolve
.Update
.Send showDialog:=False
End With
Quote:
> The following code doesn't work:
> Public Sub SendIt()
> Dim myCDO As New Outlook.MailItem
> myCDO.Attachments.Add "C:\TPTrades20000713.txt"
> myCDO.Send
> End Sub
> I receive error 429: ActiveX can't create object
> Anyone know what to do about this?