Re: Disable close button
- From: "JohnD" <JohnD@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 20 Apr 2005 13:45:01 -0700
Thanks for your help - I've got it working.
Regards
John
"Michael Bauer" wrote:
> Hi John,
>
> in this case you´d need a reference on the Inspector´s CurrentItem, too.
> E.g. the MailItem´s Close event has a Cancel parameter.
>
> --
> Viele Grüße
> Michael Bauer - MVP Outlook
>
>
> "JohnD" <JohnD@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:27477561-BA60-4433-BF12-CA07381927D7@xxxxxxxxxxxxxxxx
> > Michael
> >
> > Thank you for doing this - it really is appreciated (and I've learned
> > something about class modules at the same time). As the final step,
> I'd like
> > to add a cancel parameter to the Inspector_Close() procedure so I can
> > prevent the inspector from closing if certain conditions are not met.
> Could
> > you let me know how to go about this please?
> >
> > Thanks again for all of your effort.
> >
> > Kind regards
> >
> > John
> >
> > "Michael Bauer" wrote:
> >
> > > Hi John,
> > >
> > > here is a little sample:
> > >
> > > <ThisOutlookSession>
> > > Option Explicit
> > > Private WithEvents Inspectors As Outlook.Inspectors
> > > Private m_coll As VBA.Collection
> > > Private m_lNextKey As String
> > >
> > > Private Sub Application_Startup()
> > > Set Inspectors = Application.Inspectors
> > > Set m_coll = New VBA.Collection
> > > End Sub
> > >
> > > Private Sub Inspectors_NewInspector(ByVal Inspector As
> > > Outlook.Inspector)
> > > Dim oIns As cInspector
> > > Dim sKey As String
> > > Set oIns = New cInspector
> > > m_lNextKey = m_lNextKey + 1
> > > sKey = m_lNextKey
> > > oIns.Init Inspector, sKey, Me
> > > m_coll.Add oIns, sKey
> > > End Sub
> > >
> > > Public Sub RemoveInspector(sKey As String)
> > > On Error Resume Next
> > > m_coll.Remove sKey
> > > End Sub
> > > </ThisOutlookSession>
> > >
> > > You need to add a class module to your project. I´ve named it
> > > "cInspector". In cInspector you can handle your Inspector events.
> > >
> > > <cInspector.cls>
> > > Option Explicit
> > > Private WithEvents Inspector As Outlook.Inspector
> > > Private m_sKey As String
> > > Private m_oParent as ThisOutlookSession
> > >
> > > Public Sub Init(olInspector As Outlook.Inspector, _
> > > sKey As String, _
> > > oParent As ThisOutlookSession _
> > > )
> > > Set Inspector = olInspector
> > > m_sKey=sKey
> > > Set m_oParent=oParent
> > > End Sub
> > >
> > > Private Sub Inspector_Close()
> > > Set Inspector = Nothing
> > > m_oParent.RemoveInspector m_sKey
> > > End Sub
> > > </cInspector.cls>
> > >
> > >
> > > --
> > > Viele Grüße
> > > Michael Bauer - MVP Outlook
> > >
> > >
> > > "JohnD" <JohnD@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > > news:AA4E3A62-632D-46A8-8B51-FADDE1CAC8FC@xxxxxxxxxxxxxxxx
> > > > Michael
> > > >
> > > > Sorry, I don't know how to go about that. I'm a bit of a newcomer
> to
> > > VBA.
> > > >
> > > > Any tips would be most welcome.
> > > >
> > > > Thanks for your help.
> > > >
> > > > Regards
> > > >
> > > > John
> > > >
> > > > "Michael Bauer" wrote:
> > > >
> > > > > Hi John,
> > > > >
> > > > > you´d need a wrapper for each opened Inspector, i.e. a class
> module
> > > > > contains the WithEvents member and you create and hold an
> instance
> > > of
> > > > > that class for each Inspector.
> > > > >
> > > > > --
> > > > > Viele Grüße
> > > > > Michael Bauer - MVP Outlook
> > > > >
> > > > >
> > > > > "JohnD" <JohnD@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > > > > news:CF225DB2-C082-478F-B23F-528869DE652A@xxxxxxxxxxxxxxxx
> > > > > > I'm trying to write some vba which will disable an inspector's
> > > close
> > > > > button
> > > > > > unless the mailitem being displayed has categories set (i.e.
> <>
> > > "").
> > > > > I can
> > > > > > do this with the last inspector opened (via the NewInspector
> > > event) ,
> > > > > but if
> > > > > > I have more than one inspector open this doesn't work unless
> I'm
> > > > > closing the
> > > > > > last one opened.
> > > > > >
> > > > > > Any help would be greatly appreciated.
> > > > > >
> > > > > > Regards
> > > > > >
> > > > > > John
> > > > >
> > > > >
> > >
> > >
>
>
.
- References:
- Disable close button
- From: JohnD
- Re: Disable close button
- From: Michael Bauer
- Re: Disable close button
- From: JohnD
- Re: Disable close button
- From: Michael Bauer
- Re: Disable close button
- From: JohnD
- Re: Disable close button
- From: Michael Bauer
- Disable close button
- Prev by Date: MODI & tifs
- Next by Date: .NET Shared Add-In for Outlook - calling another form in the proje
- Previous by thread: Re: Disable close button
- Next by thread: Delete Folder
- Index(es):