PC Review


Reply
Thread Tools Rate Thread

Add attachment to CDO email

 
 
blackbox
Guest
Posts: n/a
 
      23rd Aug 2007
Having trouble aading an attachment to CDO email

Sub Send_Margins()
Dim cdoConfig
Dim msgOne

Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"mail.mailserver.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
.Update
'.Item(cdoSendUserName) = "UserName"
'.Item(cdoSendPassword) = "Password"
End With

Set msgOne = CreateObject("CDO.Message")
Set msgOne.Configuration = cdoConfig
msgOne.To = "(E-Mail Removed)"
msgOne.CC = "(E-Mail Removed)"
msgOne.From = "(E-Mail Removed)"
msgOne.Subject = "hello"
msgOne.TextBody = "test test test"
msgOne.Attachments.Add "C:\Documents and Settings\j.doe\Desktop\MarginImp.
xls"
msgOne.Send
End Sub

I get "Type mismatch" error on this line
msgOne.Attachments.Add "C:\Documents and Settings\j.doe\Desktop\MarginImp.
xls"

also tried
Dim MI As Object
Set MI = Workbooks("C:\Documents and Settings\j.doe\Desktop\MarginImp.xls")

msgOne.Attachments = MI

but get "Subscript out of range" on the Set MI line

any ideas?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200708/1

 
Reply With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      23rd Aug 2007
See
http://www.rondebruin.nl/cdo.htm

It is
..AddAttachment


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"blackbox" <u20390@uwe> wrote in message news:771bab4e81e20@uwe...
> Having trouble aading an attachment to CDO email
>
> Sub Send_Margins()
> Dim cdoConfig
> Dim msgOne
>
> Set cdoConfig = CreateObject("CDO.Configuration")
> With cdoConfig.Fields
> .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
> .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
> "mail.mailserver.com"
> .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
> = 25
> .Update
> '.Item(cdoSendUserName) = "UserName"
> '.Item(cdoSendPassword) = "Password"
> End With
>
> Set msgOne = CreateObject("CDO.Message")
> Set msgOne.Configuration = cdoConfig
> msgOne.To = "(E-Mail Removed)"
> msgOne.CC = "(E-Mail Removed)"
> msgOne.From = "(E-Mail Removed)"
> msgOne.Subject = "hello"
> msgOne.TextBody = "test test test"
> msgOne.Attachments.Add "C:\Documents and Settings\j.doe\Desktop\MarginImp.
> xls"
> msgOne.Send
> End Sub
>
> I get "Type mismatch" error on this line
> msgOne.Attachments.Add "C:\Documents and Settings\j.doe\Desktop\MarginImp.
> xls"
>
> also tried
> Dim MI As Object
> Set MI = Workbooks("C:\Documents and Settings\j.doe\Desktop\MarginImp.xls")
>
> msgOne.Attachments = MI
>
> but get "Subscript out of range" on the Set MI line
>
> any ideas?
>
> --
> Message posted via OfficeKB.com
> http://www.officekb.com/Uwe/Forums.a...mming/200708/1
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rcd email with attachment. Click on attachment , Outlook closes Lewis Starr Microsoft Outlook Discussion 0 8th Nov 2008 06:08 PM
I can send email with attachment receiver cannot open attachment =?Utf-8?B?c2FmZmk=?= Microsoft Outlook 8 5th Dec 2007 10:06 AM
Inbox Shows attachment in email, open email Attachment header MIA =?Utf-8?B?V2lsbGlz?= Microsoft Outlook Discussion 0 25th Jul 2006 10:01 PM
Outlook receive email with attachment icon but no attachment Nickson Microsoft Outlook Discussion 0 1st Dec 2005 03:52 AM
Email with attachment doesn't send the attachment =?Utf-8?B?U3VubnkyMQ==?= Microsoft Dot NET Framework 1 17th Jan 2005 04:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:27 PM.