所以我从How to add default signature in Outlook得到了以下建议。但是,在设置签名变量的地方,我始终收到错误消息“应用程序定义的错误或对象定义的错误”。 Plz HALP。
Dim OApp As Object, OMail As Object, signature As String
Set OApp = CreateObject("Outlook.Application")
Set OMail = OApp.CreateItem(0)
With OMail
.Display
End With
signature = OMail.body
With OMail
'.To = "someone@somedomain.com"
'.Subject = "Type your email subject here"
'.Attachments.Add
.body = "Add body text here" & vbNewLine & signature
'.Send
End With
Set OMail = Nothing
Set OApp = Nothing
我知道我可以从C:\ Users ... \ Signatures \文件夹中获得签名。但是,在工作中,我们所有人都使用虚拟桌面,并且权限有点混乱。
答案 0 :(得分:1)
您的签名必须声明为变体。
Dim OApp As Object
Dim OMail As Object
Dim Signature As Variant
Set OApp = CreateObject("Outlook.Application")
Set OMail = OutApp.CreateItem(0)
On Error Resume Next
With OMail
'Capture signature block.
.Display
Signature = .HTMLBody
'.To = Recipients
'.CC = CarbonCopy
.Subject = "Subject"
.HTMLBody = "<p>Add Body Here.</p>" & Signature
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing