求教,用EXCEL群发邮件时遇到编译错误,类型不匹配的问题
我是看了这篇文章之后,想通过EXCEL实现群体发送的,但遇到了编译错误,类型不匹配的问题
http://blog.csdn.net/maray/article/details/8133923
原文是32位的,由于我是64位的,已经在Declare后面增加了PtrSafe
但是运行的时候还是会这样,想请教一些该怎么修改。。。公司邮箱是exchange,用第三方工具都不行,只有这条路了
[解决办法]
你群发的数量多吗?
不是很多的话把前面的都删掉。
' ·¢?íμ¥??óê?tμ?×ó3ìDò
Sub SendMail(ByVal to_who As String, ByVal subject As String, ByVal body As String, ByVal attachement As String)
Dim objOL As Object
Dim itmNewMail As Object
'òyó?Microsoft Outlook ???ó
Set objOL = CreateObject("Outlook.Application")
Set itmNewMail = objOL.CreateItem(olMailItem)
With itmNewMail
.subject = subject '?÷??
.body = body '?y??±???
.To = to_who 'ê??t??
'.Attachments.Add attachement '???t£?è?1???2?Dèòa·¢?í???t£??éò?°??aò???é?μ??′?é£?Excel?Dμ?μú??áDá???£?2??üé???
.Send '???ˉOutlook·¢?í′°?ú
End With
Set objOL = Nothing
Set itmNewMail = Nothing
End Sub
Sub delay(T As Single)
Dim T1 As Single
T1 = Timer
Do
DoEvents
Loop While Timer - T1 < T
End Sub
'?úá?·¢?íóê?t
Sub BatchSendMail()
Dim rowCount, endRowNo
endRowNo = Cells(1, 1).CurrentRegion.Rows.Count
'?eDD·¢?íóê?t
For rowCount = 1 To endRowNo
SendMail Cells(rowCount, 1), Cells(rowCount, 2), Cells(rowCount, 3), Cells(rowCount, 4)
delay 3
Next
End Sub