我联系了不同部门的几位同事,出于合规性的考虑,所有电子邮件都将使用默认的电子邮件签名。
我设法使用 Excel VBA 生成了一封总括电子邮件,所有电子邮件的正文均相同,但根据员工的位置和标准进行了更改。
我的签名未填写。
Sub send_mass_email()
Dim i As Integer
Dim Greeting, email, body, subject, business, Website As String
Dim OutApp As Object
Dim OutMail As Object
body = ActiveSheet.TextBoxes("TextBox 1").Text
i = 2
Do While Cells(i, 1).Value <> ""
Greeting = Cells(i, 2).Value
email = Cells(i, 3).Value
body = ActiveSheet.TextBoxes("TextBox 1").Text
subject = Cells(i, 4).Value
business = Cells(i, 1).Value
Website = Cells(i, 5).Value
' replace place holders
body = Replace(body, "B2", Greeting)
body = Replace(body, "A2", business)
body = Replace(body, "E2", Website)
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.to = email
.subject = subject
.body = body & Signature
'.Attachments.Add ("") 'You can add files here
.display
'.Send
End With
'reset body text
body = ActiveSheet.TextBoxes("TextBox 1").Text
i = i + 1
Loop
Set OutMail = Nothing
Set OutApp = Nothing
MsgBox "Email(s) Sent!"
End Sub
在进行任何与正文相关的修改之前调用
Display
方法以在消息正文中生成/添加默认签名:
With OutMail
.display
.to = email
.subject = subject
'.body = body & Signature
'.Attachments.Add ("") 'You can add files here
'.Send
End With