PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Item_Open and NewInspector events not triggered?
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Item_Open and NewInspector events not triggered?
![]() |
Item_Open and NewInspector events not triggered? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hallo! I need opening my form(based on mailItem) and hide some standar buttons(Reply,Replay all...) and open my own toolbar with commandbuttons to make some task. managed with showing/hiding toolbars and commandbuttons on it. The problem is that opening creating a ne mail or opening an existing one(my for or standart mail) I not ALWAYS get event objContactItem_Open I define if that is my form : ' Declaration of events objects Dim myOlApp As New Outlook.Application Private WithEvents olInboxItems As Items Public WithEvents myOlExp As Outlook.Explorer Public WithEvents myOlInspectors As Outlook.Inspectors Public WithEvents objContactItem As Outlook.MailItem ' Object fo Events of mailItem Private Sub Application_Startup() ' Create Inspector object Set myOlInspectors = myOlApp.Inspectors ... End Sub Private Sub myOlInspectors_NewInspector(ByVal Inspector A Outlook.Inspector) Dim TempObject As Object On Error Resume Next Inspector.WindowState = olMaximized ' Maximize the inspector Set TempObject = Inspector.CurrentItem If Not TypeOf TempObject Is Outlook.MailItem Then Exit Sub ' If that is not a mailItem - hide toolbar wit commandbars End If Set objContactItem = TempObject ' Create object of event ONLY fo mailItems End Sub ' This event very often not triggered! Private Sub objContactItem_Open(Cancel As Boolean) ' This event ver often not triggered! Dim Item As Object On Error Resume Next If Not TypeOf objContactItem Is Outlook.MailItem Then ShowDocSignToolBar (False) ' if this control comes to this functio than ALL WRIGHT ! Exit Sub ' If that is not a mailItem - hide toolbar wit commandbars End If ... end sub ... I don't know why but events objContactItem_Open an myOlInspectors_NewInspector very often are not triggered! But as I understand these event must be triggered any time as I ope new or existing mail. I set breakpoints in these events but they not allways works. And as a result opening m form very often I don't see my toolbar and in simple mails I see my toolbar though I tried to hide it! I use OutLook 2000 SP-(9.0.0.6627) russian version. What is wrong ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
|
|
|
#2 |
|
Guest
Posts: n/a
|
If you are using WordMail with Outlook 2000 then NewInspector and
various other event may not fire and are unreliable. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginners Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "NilovSerge" <NilovSerge.11v0ep@outlookforum.com> wrote in message news:NilovSerge.11v0ep@outlookforum.com... > > Hallo! > I need opening my form(based on mailItem) and hide some standard > buttons(Reply,Replay all...) > and open my own toolbar with commandbuttons to make some task. I > managed with showing/hiding toolbars > and commandbuttons on it. The problem is that opening creating a new > mail or opening an existing one(my for > or standart mail) I not ALWAYS get event objContactItem_Open > I define if that is my form : > ' Declaration of events objects > Dim myOlApp As New Outlook.Application > Private WithEvents olInboxItems As Items > Public WithEvents myOlExp As Outlook.Explorer > Public WithEvents myOlInspectors As Outlook.Inspectors > Public WithEvents objContactItem As Outlook.MailItem ' Object for > Events of mailItem > > > Private Sub Application_Startup() ' Create Inspector object > Set myOlInspectors = myOlApp.Inspectors > .. > End Sub > > > Private Sub myOlInspectors_NewInspector(ByVal Inspector As > Outlook.Inspector) > Dim TempObject As Object > On Error Resume Next > Inspector.WindowState = olMaximized ' Maximize the inspector > > Set TempObject = Inspector.CurrentItem > If Not TypeOf TempObject Is Outlook.MailItem Then > Exit Sub ' If that is not a mailItem - hide toolbar with > commandbars > End If > Set objContactItem = TempObject ' Create object of event ONLY for > mailItems > End Sub ' This event very often not triggered! > > > Private Sub objContactItem_Open(Cancel As Boolean) ' This event very > often not triggered! > Dim Item As Object > On Error Resume Next > If Not TypeOf objContactItem Is Outlook.MailItem Then > ShowDocSignToolBar (False) ' if this control comes to this function > than ALL WRIGHT ! > Exit Sub ' If that is not a mailItem - hide toolbar with > commandbars > End If > .. > end sub > .. > I don't know why but events objContactItem_Open and > myOlInspectors_NewInspector very often are not triggered! > But as I understand these event must be triggered any time as I open > new or existing mail. I set breakpoints > in these events but they not allways works. And as a result opening my > form very often I don't see my toolbar > and in simple mails I see my toolbar though I tried to hide it! > I use OutLook 2000 SP-(9.0.0.6627) russian version. What is wrong? > > > ------------------------------------------------ > ~~ Message posted from http://www.ExcelTip.com/ > ~~View and post usenet messages directly from http://www.ExcelForum.com/ > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

