我正在尝试创建一个在单击引用自身的超链接时运行的宏。 我想用预定义的TO,CC,Subject,FROM创建一个outlook电子邮件,希望是签名行。 目标单元格将是超链接,并且上述值已存储在同一行(右侧)的单元格中。
Email To CC From Subject Body Store Variance Date
Email now Value Value Value Value Not sure Value Value Value
所有值当前都存储为文本字符串。我希望用户能够点击“立即发送电子邮件”,并根据右侧同一行中的单元格生成一封电子邮件。
Example Email:
From: Mybox@work.com
To: Store1@work.com; manager1@work.com
CC: P1@work.com; P2@work.com; <- CC line varies based on variance value
Subject: Store# Product type date variance
Body: Premade text with values as per above also in here
是否也可以添加用户签名?
我查看了ron de bruin的电子邮件信息,我在这方面并不是最好的,也无法弄明白。
答案 0 :(得分:1)
这是实现目标的最简单方法。
已经过测试
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim Rw As Long
If Target.Range.Column = 1 Then
If UCase(Target.Range.Value) = "EMAIL NOW" Then
Rw = Target.Range.Row
Dim OutApp As Object, OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = Cells(Rw, 2)
.CC = Cells(Rw, 3)
'
'~~> So On
'
.Display
End With
End If
End If
End Sub