Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50090

Sending Email by Macro.

$
0
0
hi all,

I have a Macro which located at a share drive and able to auto send out some Emails when i click "Mail" button.

it works perfectly until yesterday.
today i changed a new CPU with higher speed. i opened the same macro from share drive but it pops me this error:
Capture.JPG

then, i changed back my old CPU and opened the same macro from share drive, it works perfectly again.
why is that happen?

below is my codes: the error stuck at ".send" (bold)
Code:

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/smtpauthenticate") = 0 '1 - 13-Jan
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "swd-ex01"
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        .Update
    End With
   
    subj = subjectText
    'If (mType <> "NOTICE") Then
        If (vname <> "") Then subj = vname & " - " & subj
        If (bc <> "") Then subj = subj & " (" & bc & ")"
    'End If
    If (email_Add <> "") Then
        With iMsg
            Set .Configuration = iConf
            .To = email_Add
            .CC = senderText
            .BCC = ""
            .From = senderText
            .Subject = subj
            .TextBody = messageText

            If (attachment <> "") Then
                If (StandardFile = "") Then
                    .addattachment attachment
                Else
                    .addattachment StandardFile
                End If
            End If
            .Send
        End With
    End If


Viewing all articles
Browse latest Browse all 50090

Trending Articles