|
-
Oct 18th, 2005, 07:16 AM
#1
Thread Starter
New Member
E-Mailing Using CDO
Hi,
I'm using the following code in VBA (in Excel) to try to e-mail a number of attachments to a list of recipients :
VB Code:
Sub Send_Emails()
Sheets("Menu").Select
Application.ScreenUpdating = False
Application.StatusBar = "E_Mailing RFQs to Suppliers ..."
Sheets("DailyRFQs").Select
' On Error GoTo cleanup
For Each VCODE In Range("VCODE")
Set objCDOMessage = CreateObject("CDO.Message")
Set objCDOConfig = CreateObject("CDO.Configuration")
With objCDOMessage
Set .Configuration = objCDOConfig
.To = VCODE.Offset(0, 2).Value
.Subject = "RFQ: " & VCODE.Offset(0, 12).Value & " - " & VCODE.Value & " " & VCODE.Offset(0, 1).Value
.TextBody = vbNewLine & vbNewLine & _
"Text"
.AddAttachment VCODE.Offset(0, 7).Value
.AddAttachment VCODE.Offset(0, 8).Value
.AddAttachment VCODE.Offset(0, 9).Value
.AddAttachment VCODE.Offset(0, 11).Value
.Send 'Or use Display
.Display
' VCODE.Offset(0, 9).Value = "YES"
End With
Set iMsg = Nothing
Next
cleanup:
Set objCDOMessage = Nothing
Set objCDOConfig = Nothing
Application.ScreenUpdating = True
End Sub
On execution I get the following message :
Run-time error '-2147220960 (80040220)':
The "SendUsing" configuration value is invalid.
Does anyone have any suggestions how I can get around this ? I'm tearing me hair out here !!
Last edited by RobDog888; Oct 18th, 2005 at 02:08 PM.
Reason: Added [vbcode] tags
-
Oct 18th, 2005, 07:30 AM
#2
Re: E-Mailing Using CDO
Greg..
You need to configure the configuration, by setting the server and port options...
VB Code:
.Configuration.Fields.Item("smtpserver") = "username/outgoingserver"
.Configuration.Fields.Item("smtpserverport") = 25
.Configuration.Fields.Item("sendusing") = CdoSendUsingPort
.Configuration.Fields.Update
Add this into the With.. End With section and it should work.. you will also need to change the username/outgoingserver to match yours.. If this is exchange then you may not be able to do it..
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Oct 18th, 2005, 08:03 AM
#3
Thread Starter
New Member
Re: E-Mailing Using CDO
Thanks for that Danny but i haven't got an smtp address as I'm networked unfortunately, so it hasn't worked . . . which is a bugger ! Any idea how I can change the code to send the e-mails using GroupWise as this is what the company uses to send e-mails ?
-
Oct 18th, 2005, 08:05 AM
#4
Re: E-Mailing Using CDO
I have no experience with GroupWise.. but take a look at the configuration in the application to see how it is sending the email from the email account..
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|