moduleoutlookexplorer.bas

来自「Outlook Inspector Explorer Trap Events C」· BAS 代码 · 共 50 行

BAS
50
字号
Attribute VB_Name = "moduleOutlookExplorer"
Option Explicit
'*********************************************************************
' copyright 2002 by Martin Nemzow (mnemzow@networkperf.com)
' You can use this code freely and distribute it.
' No warrantee granted or implied.
' this is a very loose modification of Randy Byrne's CBITEMS OUTLOOK
' COM Add-In in order to trap inspector events along side explorer events
' and watch the sequence of the events. The debugger works with it.
'
'... yes you can use this to add CommandBar items. But note that I have
' changed some variable names and added new classes with longer names
' so that it cuold be debugged and make some sense for reading to me.
' You are welcome to correct anything you want and tell me.
' the comments with '[2002] remove functionality available only in
' OUTLOOK 2002 and in OUTLOOK 2000. I appreciate everyone's efforts to
' decode how to automate Outlook, so if you have comments and changes
' I would very much appreciate it, and I think others will too.
'*********************************************************************

'************************************************************
 'Module: moduleOutlookExplorer
 'Purpose: Maintain a collection of Outlook Explorer objects
 '************************************************************
Public gbl_colExplorerWrapper As New Collection
Public gbl_objApplication As Outlook.Application
Public gbl_ProgID As String

Dim nID As Integer
Public Sub AddExplorer(Explorer As Outlook.Explorer)
     Dim objclsExplorerWrapper As New clsExplorerWrapper

     objclsExplorerWrapper.Explorer = Explorer

     objclsExplorerWrapper.Key = nID
     gbl_colExplorerWrapper.Add objclsExplorerWrapper, CStr(nID)
     nID = nID + 1
End Sub
Public Sub KillExplorer(ID As Integer, objclsExplorerWrapper As clsExplorerWrapper)
     Dim objclsExplorerWrapper2 As clsExplorerWrapper

     Set objclsExplorerWrapper2 = gbl_colExplorerWrapper.Item(CStr(ID))
     If Not objclsExplorerWrapper2 Is objclsExplorerWrapper Then
         Err.Raise 1, Description:="Unexpected Error in KillExplorer"
         Exit Sub
     End If

     gbl_colExplorerWrapper.Remove CStr(ID)
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?