2,462
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private WithEvents mItem As MailItem
Public WithEvents myExplorer As Explorer
' #########
' 析构函数.
' #########
Private Sub Class_Terminate()
If Not (mItem Is Nothing) Then
Set mItem = Nothing
End If
If Not (myExplorer Is Nothing) Then
Set myExplorer = Nothing
End If
End Sub
' #############################################################
' 事件: 当用户为项目 (父对象的一个实例) 选择 "答复" 动作时发生.
' #############################################################
Private Sub mItem_Reply(ByVal Response As Object, _
Cancel As Boolean)
'设置文本格式为纯文本
Response.BodyFormat = OlBodyFormat.olFormatPlain
MsgBox ("ok")
End Sub
' ##################################################
' 事件: 选择其他或更多 Microsoft Outlook 项目时发生.
' ##################################################
Private Sub myExplorer_SelectionChange()
Dim mySel As Selection
Set mySel = myExplorer.Selection
' /* 浏览器窗口中有且只有一个项目被选中. */
If mySel.Count = 1 Then
Dim objItem As Object
Set objItem = mySel.Item(1)
' /* 该选中项目是邮件. */
If objItem.Class = olMail Then
' /* 动态注册邮件的 Reply 事件. */
Set mItem = objItem
End If
End If
Set mySel = Nothing
Set objItem = Nothing
End Sub
' #####################################
' 强制触发浏览器窗口中的选中项改变事件.
' #####################################
Public Sub ForceSelectionChange()
Call myExplorer_SelectionChange
End Sub
Response.BodyFormat = OlBodyFormat.olFormatPlain
‘应改为
Response.BodyFormat = 1 'CdoBodyFormatText 'Response.BodyFormat =OlBodyFormat.olFormatPlain