Explorers Collection Events
There is only one event for the Explorer collection object: the NewExplorer event.
NewExplorer
The NewExplorer event fires after a new Explorer window has been created and before it is displayed. A new Explorer window can be created through a user action or through your code. If you have dimensioned an Explorer object variable using WithEvents, the NewExplorer event is the correct location to set a reference to that Explorer object. Outlook passes an Explorer object to the NewExplorer event procedure. The cmdNewExplorerprocedure shown next runs as an Outlook macro in a VBA code module. Once the code runs, the NewExplorer event causes the Explorer window for the Contacts folder to be displayed in the upper left corner of the display.
Sub cmdNewExplorer() Dim colExplorers As Outlook.Explorers Set colExplorers = Application.Explorers Set objFolder = Application.GetNameSpace("MAPI").GetDefaultFolder _ (olFolderContacts) Set objExplorer = colExplorers.Add _ (objFolder, olFolderDisplayNavigation) objExplorer.Display End Sub Private Sub colExpl_NewExplorer(ByVal Explorer As Explorer) Set objExpl = Explorer With objExpl .Left = 0 .Top = 0 End With End Sub
No comments:
Post a Comment