Results 1 to 4 of 4

Thread: E-Mailing Using CDO

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    8

    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:
    1. Sub Send_Emails()
    2.          
    3.     Sheets("Menu").Select
    4.     Application.ScreenUpdating = False
    5.     Application.StatusBar = "E_Mailing RFQs to Suppliers ..."
    6.     Sheets("DailyRFQs").Select
    7.    
    8.    '    On Error GoTo cleanup
    9.    
    10.     For Each VCODE In Range("VCODE")
    11.        
    12.        
    13.                         Set objCDOMessage = CreateObject("CDO.Message")
    14.                         Set objCDOConfig = CreateObject("CDO.Configuration")
    15.                        
    16.                         With objCDOMessage
    17.                             Set .Configuration = objCDOConfig
    18.                                 .To = VCODE.Offset(0, 2).Value
    19.                                 .Subject = "RFQ: " & VCODE.Offset(0, 12).Value & " - " & VCODE.Value & " " & VCODE.Offset(0, 1).Value
    20.                                 .TextBody = vbNewLine & vbNewLine & _
    21.                                 "Text"
    22.                             .AddAttachment VCODE.Offset(0, 7).Value
    23.                             .AddAttachment VCODE.Offset(0, 8).Value
    24.                             .AddAttachment VCODE.Offset(0, 9).Value
    25.                             .AddAttachment VCODE.Offset(0, 11).Value
    26.                             .Send  'Or use Display
    27.                             .Display
    28. '                            VCODE.Offset(0, 9).Value = "YES"
    29.                         End With
    30.                         Set iMsg = Nothing
    31.                        
    32.     Next
    33.  
    34. cleanup:
    35.     Set objCDOMessage = Nothing
    36.     Set objCDOConfig = Nothing
    37.  
    38.     Application.ScreenUpdating = True
    39.  
    40. 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width