Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add attachment to CDO email
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 = " msgOne.CC = " msgOne.From = " 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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Add attachment to CDO email
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 = " msgOne.CC = " msgOne.From = " 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sending a Spreadsheet as an Email Attachment vs. Imbedded in Email | Excel Discussion (Misc queries) | |||
send wkbk as an email attachment with an email address copied from | Excel Discussion (Misc queries) | |||
email attachment | New Users to Excel | |||
email as attachment | Excel Discussion (Misc queries) | |||
VBA to Email Attachment | Excel Programming |