当我想接受会议请求时,我得到运行时错误438 - >运行调试后,错误行是:
If TypeOf objItem Is Outlook.MailItem And objItem.BodyFormat = olFormatHTML Then
Sub AddBanner()
' version: 1.0
'=================================================================
Dim BannerURL As String
Dim BannerTargetURL As String
Dim BannerWidth As Integer
Dim BannerHeight As Integer
Dim PromptSend As Boolean
'==================BEGIN MODIFY ================================================
BannerURL = "http://domain.tld/email_signature/banner.png"
BannerTargetURL = ""
BannerWidth = 361
BannerHeight = 61
PromptSend = False
'==================END MODIFY ==================================================
If TypeOf objItem Is Outlook.MailItem And objItem.BodyFormat = olFormatHTML Then
If PromptSend = True Then
Dim Result As VbMsgBoxResult
Result = MsgBox("Do you want to include your banner to this message?", _
vbQuestion + vbYesNo, "Add Banner")
If Result = vbNo Then
Exit Sub
End If
End If
Dim strTopHTML As String
strTopHTML = "<p><a href=""" & BannerTargetURL & """><img width=""" _
& BannerWidth & """ height=""" & BannerHeight & _
""" src=""" & BannerURL & """ /></a></p>"
strHTMLBody = objItem.HTMLBody
intTagStart = InStr(1, strHTMLBody, "<body", vbTextCompare)
intTagEnd = InStr(intTagStart + 5, strHTMLBody, ">")
strBodyTag = Mid(strHTMLBody, intTagStart, intTagEnd - intTagStart + 1)
objItem.HTMLBody = Replace(strHTMLBody, strBodyTag, strBodyTag & strTopHTML)
End If
End Sub