- ©«¤l
- 16
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 41
- ÂI¦W
- 0
- §@·~¨t²Î
- WINDWOS 7
- ³nÅ骩¥»
- OFFICE 2003
- ¾\ŪÅv
- 10
- ©Ê§O
- ¤k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2010-10-12
- ³Ì«áµn¿ý
- 2014-7-7
|
¤S¨Ó½Ð°Ý¦U¦ì°ª¤â ¡A¤@קïVB³£µo¥Í¿ù»~ :Q ÁÂÁÂ
(1) username¡Bpassword ¦p¦óצ¨¤£«ü©wÄæ¦ìÈ¡A¥iª½±µ¦bVB¤W
(2) strTextBody¤º®e ¥i¥H«ü©w SHEETÄæ¦ì½d³ò EX:¤U±¹Ï¤ù
Private Sub cmdSendMail_Click()
Dim objCdo As Object
'Dim objCdo As CDO.Message
strCfg = "http://schemas.microsoft.com/cdo/configuration/"
'Set objCdo = New CDO.Message
Set objCdo = CreateObject("CDO.Message")
i = 2
With objCdo
.From = Sheet1.Range("from")
.Fields("urn:schemas:mailheader:X-Priority") = 1 ' Priority = PriorityUrgent °ªÀu¥ý¶¶§Ç
.Configuration(strCfg & "sendusing") = 2 ' Sendusing = SendUsingPort
.Configuration(strCfg & "smtpserver") = Sheet1.Range("smtp") ' SMTP Server
End With
If Sheet1.Range("username") <> "" Then
' SMTP Server ¦p»Ýµn¿ý , «h»Ý³]©w UserName / Password
objCdo.Configuration(strCfg & "sendusername") = Sheet1.Range("username")
objCdo.Configuration(strCfg & "sendpassword") = Sheet1.Range("password")
End If
objCdo.Configuration.Fields.Update ' §ó·s (Äæ¦ì) ²ÕºA
While Sheet2.Range("A" & i) <> ""
objCdo.To = Sheet2.Range("A" & i)
objCdo.CC = Sheet2.Range("B" & i)
objCdo.BCC = Sheet2.Range("c" & i)
objCdo.Subject = Sheet2.Range("d" & i)
strTextBody = Sheet2.Range("e" & i)
If Sheet1.Range("type") = "txt" Then
objCdo.TextBody = strTextBody
Else
objCdo.HTMLBody = strTextBody
End If
j = 6
objCdo.Attachments.DeleteAll '§R°£«e¤@«Êªºªþ¥ó
While Sheet2.Cells(i, j) <> ""
objCdo.AddAttachment Sheet2.Cells(i, j)
j = j + 1
Wend
objCdo.Send '±Nemail±H¥X
Sheet2.Range("k" & i) = "±H¥X"
i = i + 1
Wend
Set iMsg = Nothing
Set iConf = Nothing
End Sub |
|