vba 添加outlook 签名_在Excel 2013中使用vba插入电子邮件签名

“这在我的错误例程中出现错误91”当调试时不使用错误例程 . 通过这种方式,您可以看到问题所在并可以说出问题所在 .

可能是

Set objCBP = objInsp.CommandBars.ActiveMenuBar.FindControl(, 30005)

见CommandBars.FindControl Method (Office) "The use of CommandBars in some Microsoft Office applications has been superseded by the new ribbon component of the Microsoft Office Fluent user interface."

可能这个:

Sub Mail_Outlook_With_Signature_Html_2()

' Don't forget to copy the function GetBoiler in the module.

' Working in Office 2000-2013

'Dim OutApp As Object

Dim OutMail As Object

Dim strbody As String

Dim SigString As String

Dim Signature As String

'Set OutApp = CreateObject("Outlook.Application")

'Set OutMail = OutApp.CreateItem(0)

Set OutMail = CreateItem(0)

strbody = "

Dear Customer Ron de Bruin

" & _

"Please visit this website to download the new version.
" & _

"Let me know if you have problems.
" & _

"Ron's Excel Page" & _

"Thank you"

'Change only Mysig.htm to the name of your signature

SigString = Environ("appdata") & _

"\Microsoft\Signatures\Mysig.htm"

If Dir(SigString) <> "" Then

Signature = GetBoiler(SigString)

Else

Signature = ""

End If

On Error Resume Next

With OutMail

'.To = "ron@debruin.nl"

.CC = ""

.BCC = ""

.Subject = "This is the Subject line"

.HTMLBody = strbody & "
" & Signature

'.Send

'or use

.Display

End With

On Error GoTo 0

Set OutMail = Nothing

'Set OutApp = Nothing

End Sub

Function GetBoiler(ByVal sFile As String) As String

'Dick Kusleika

Dim fso As Object

Dim ts As Object

Set fso = CreateObject("Scripting.FileSystemObject")

Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)

GetBoiler = ts.readall

ts.Close

End Function

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值