|
因为要对客户发邀请信,在网上下载了一段代码,有的看得懂,有的看不懂,望版主帮忙注释这段代码:
Sub mailto()
Application.ScreenUpdating = False
Dim objOL As Object
Dim itmNewMail As Object
Dim i%, j%, k%, x%, y%
Dim strbt() As String, strsj() As String, strsum$
Set objOL = CreateObject("Outlook.Application")
Sheets(1).Activate
ActiveSheet.Range("a1").Select
Set tk = ActiveCell.CurrentRegion
k = tk.Columns.Count
j = tk.Rows.Count - 1
ReDim strbt(k)
For i = 0 To k
strbt(i) = Trim(Sheets(1).Range("a1").Offset(0, i).Value)
Next i
For x = 1 To j - 1
If Trim(Sheets(3).Range("c" & x + 1)) <> "" Then
Set itmNewMail = objOL.CreateItem(olMailItem)
itmNewMail.Subject = Trim(Sheets(1).Range("a1").Offset(x, 1).Value) '& "" & Month(Date) & ""
itmNewMail.To = Trim(Sheets(3).Range("c" & x + 1))
For y = 0 To k
ReDim strsj(y)
strsj(y) = Sheets(1).Range("a1").Offset(x, y).Value
strsum = strsum & strbt(y) & " " & strsj(y) & vbCrLf
Next y
itmNewMail.body = strsum & vbNewLine & " " '& Month(Date) & "" '& vbNewLine & Space(60) & "" ' & vbNewLine & Space(65) & Date
itmNewMail.display
Application.OnTime Now + TimeValue("00:00:05"), "hd"
strsum = ""
End If
Next x
itmNewMail.send
Set objOL = Nothing
Set itmNewMail = Nothing
Application.ScreenUpdating = True
End Sub
Sub hd()
SendKeys "%{s}", True
End Sub
在线等,急用
把文件发上来,供参考。另我要对不同用户发内容相同的信件,可不可以群发形式发送。
附件: |
|