All,
I am trying to create an embedded image in a CDO set up mail.
This is what i have....
	
	
	
		
... but i keep getting an error message saying variable not defined where the red highlight is?? can anyone help with this/see where i'm going wrong??
Thanks, spin
 I am trying to create an embedded image in a CDO set up mail.
This is what i have....
		Code:
	
	
	Function SendEmail(strFrom As String, _
                    strTo As String, _
                    strSubject As String, _
                    Optional strBody As String = "", _
                    Optional strHTML As String = "", _
                    Optional strCc As String = "", _
                    Optional strBcc As String = "", _
                    Optional strAttach As String = "")
 
 On Error GoTo ErrorHandler
    Dim iMsg As Object
    Dim iConf As Object
    Dim Flds As Object
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
    
    iConf.Load -1    ' CDO Source Defaults
    Set Flds = iConf.Fields
    With Flds
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "146.105.64.125"
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        .Update
    End With
    
    
    Dim objImage As Object
    Dim myPic As String
    
        Set objImage = iMsg.AddRelatedBodyPart(GetImagePath & "Computacenter logo mini.gif", "cclogo.gif", [COLOR="Red"]CdoReferenceTypeName[/COLOR])
        objImage.Fields.Item("urn:schemas:mailheader:Content-ID") = "<cclogo.gif>"
        objImage.Fields.Update
        myPic = "<html><img src=""cid:cclogo.gif"" alt=""CC Logo"" /></br></html>"
                 
               
    With iMsg
        Set .Configuration = iConf
        .To = strTo                                         'To
        If strCc <> "" Then .CC = strCc                     'Cc
        If strBcc <> "" Then .BCC = strBcc                  'Bcc
        .FROM = strFrom                                     'From
        .Subject = strSubject                               'Subject
        If strHTML <> "" Then .HTMLBody = myPic & strHTML   'HTML body
        If strBody <> "" Then .TextBody = strBody           'Text body
        If strAttach <> "" Then .AddAttachment strAttach    'Attachment
        .Send
    End With
    
    SendEmail = True
ExitHere:
Exit Function
ErrorHandler:
MsgBox Err.Number & " - " & Err.Description
SendEmail = False
Resume ExitHere
    
End Function
	... but i keep getting an error message saying variable not defined where the red highlight is?? can anyone help with this/see where i'm going wrong??
Thanks, spin