Is Explorer.FolderSwitch the best event for hiding commandbarbutton?

  • Thread starter tneslony@gmail.com
  • Start date
Status
Not open for further replies.
T

tneslony@gmail.com

Greetings all,

I recently developed an outlook addin that adds a button to the

command bar. I need to hide this when not viewing emails. I took the

following strategy to do so:

Private Sub m_olExplorer_FolderSwitch()

Select Case m_olExplorer.CurrentFolder.Name

Case "Inbox"

objCommandBarButton.Visible = True

Case Else

objCommandBarButton.Visible = False

End Select

End Sub

The problem is that there is quite a bit of flicker (looks horrible).

The commandbar appears, then the Folderswitch event fires, then the

button is (re)enabled. It appears that everything else is occuring at

an earlier event... Any ideas?

-Tim
 
K

Ken Slovak - [MVP - Outlook]

Use Explorer.BeforeFolderSwitch().

<tneslony@gmail.com> wrote in message

news:2a534a55-d6dc-4de0-82e3-af4f793b29f6@z8g2000prd.googlegroups.com...
> Greetings all,

> I recently developed an outlook addin that adds a button to the
> command bar. I need to hide this when not viewing emails. I took the
> following strategy to do so:

> Private Sub m_olExplorer_FolderSwitch()
> Select Case m_olExplorer.CurrentFolder.Name
> Case "Inbox"
> objCommandBarButton.Visible = True
> Case Else
> objCommandBarButton.Visible = False
> End Select
> End Sub

> The problem is that there is quite a bit of flicker (looks horrible).
> The commandbar appears, then the Folderswitch event fires, then the
> button is (re)enabled. It appears that everything else is occuring at
> an earlier event... Any ideas?

> -Tim
 
T

tneslony@gmail.com

Re: Is Explorer.FolderSwitch the best event for hidingcommandbarbutton?

Hi Ken,

Thank you for your quick reply. I tried using the BeforeFolderSwitch

event, however I can't seem to figure out which folder will be

selected next. The m_olExplorer.CurrentFolder.Name returns (as one

would expect) the current folder.

Just to give you some background, I'm trying to hide or disable a

commandbarbutton when not viewing email (i.e. hide for calendar,

tasks, journal, etc...). Sorry if this a backwards method for

accomplishing this task. Can you suggest a better strategy?

PS: Thank you very much for sharing your VB6 template... It has made

learning Outlook programming a much more pleasant experience.

-Tim

On May 1, 11:12 am, "
<kenslo...@mvps.org> wrote:
> Use Explorer.BeforeFolderSwitch().

> >

> http://www.slovaktech.com

> <tnesl...@gmail.com> wrote in message

> news:2a534a55-d6dc-4de0-82e3-af4f793b29f6@z8g2000prd.googlegroups.com...
>
> > Greetings all,

>
> > I recently developed an outlook addin that adds a button to the
> > command bar.  I need to hide this when not viewing emails.  I took the
> > following strategy to do so:

>
> > Private Sub m_olExplorer_FolderSwitch()
> >    Select Case m_olExplorer.CurrentFolder.Name
> >        Case "Inbox"
> >            objCommandBarButton.Visible = True
> >        Case Else
> >            objCommandBarButton.Visible = False
> >    End Select
> > End Sub

>
> > The problem is that there is quite a bit of flicker (looks horrible).
> > The commandbar appears, then the Folderswitcheventfires, then the
> > button is (re)enabled. It appears that everything else is occuring at
> > an earlierevent...  Any ideas?

>
> > -Tim
 
T

tneslony@gmail.com

Re: Is Explorer.FolderSwitch the best event for hidingcommandbarbutton?

And sorry for the double post... Didn't realize that I'd already done

so. I appreciate your support.

-Tim

On May 1, 11:12 am, "
<kenslo...@mvps.org> wrote:
> Use Explorer.BeforeFolderSwitch().

> >

> http://www.slovaktech.com

> <tnesl...@gmail.com> wrote in message

> news:2a534a55-d6dc-4de0-82e3-af4f793b29f6@z8g2000prd.googlegroups.com...

>
> > Greetings all,

>
> > I recently developed an outlook addin that adds a button to the
> > command bar.  I need to hide this when not viewing emails.  I took the
> > following strategy to do so:

>
> > Private Sub m_olExplorer_FolderSwitch()
> >    Select Case m_olExplorer.CurrentFolder.Name
> >        Case "Inbox"
> >            objCommandBarButton.Visible = True
> >        Case Else
> >            objCommandBarButton.Visible = False
> >    End Select
> > End Sub

>
> > The problem is that there is quite a bit of flicker (looks horrible).
> > The commandbar appears, then the Folderswitch event fires, then the
> > button is (re)enabled. It appears that everything else is occuring at
> > an earlier event...  Any ideas?

>
> > -Tim-


 
K

Ken Slovak - [MVP - Outlook]

The VB6 signature of that event is:

BeforeFolderSwitch(NewFolder As Object, Cancel As Boolean)

NewFolder is the MAPIFolder that will be switched to, so just use that.

NewFolder.Name will return the name of the new folder.

If you set Cancel = True that will prevent the switch from occurring. If you

set it False or don't touch it at all the switch will occur.

<tneslony@gmail.com> wrote in message

news:f35ec698-52ad-4691-b414-7dae2de739fd@w31g2000prd.googlegroups.com...

Hi Ken,

Thank you for your quick reply. I tried using the BeforeFolderSwitch

event, however I can't seem to figure out which folder will be

selected next. The m_olExplorer.CurrentFolder.Name returns (as one

would expect) the current folder.

Just to give you some background, I'm trying to hide or disable a

commandbarbutton when not viewing email (i.e. hide for calendar,

tasks, journal, etc...). Sorry if this a backwards method for

accomplishing this task. Can you suggest a better strategy?

PS: Thank you very much for sharing your VB6 template... It has made

learning Outlook programming a much more pleasant experience.

-Tim
 
T

tneslony@gmail.com

Re: Is Explorer.FolderSwitch the best event for hidingcommandbarbutton?

Thank you so much Ken! Worked exactly as you described. Have a great

week.

-Tim

On May 4, 4:17 am, " - " <kenslo...@mvps.org
wrote:
> The VB6 signature of that event is:

>     BeforeFolderSwitch(NewFolder As Object, Cancel As Boolean)

> NewFolder is the MAPIFolder that will be switched to, so just use that.
> NewFolder.Name will return the name of the new folder.

> If you set Cancel = True that will prevent the switch from occurring. If you
> set it False or don't touch it at all the switch will occur.

> >

> http://www.slovaktech.com

> <tnesl...@gmail.com> wrote in message

> news:f35ec698-52ad-4691-b414-7dae2de739fd@w31g2000prd.googlegroups.com...
> Hi Ken,

> Thank you for your quick reply.  I tried using the BeforeFolderSwitch
> event, however I can't seem to figure out which folder will be
> selected next.  The m_olExplorer.CurrentFolder.Name returns (as one
> would expect) the current folder.

> Just to give you some background, I'm trying to hide or disable a
> commandbarbutton when not viewing email (i.e. hide for calendar,
> tasks, journal, etc...).  Sorry if this a backwards method for
> accomplishing this task.  Can you suggest a better strategy?

> PS:  Thank you very much for sharing your VB6 template...  It has made
> learning Outlook programming a much more pleasant experience.

> -Tim
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
K Working with Explorer.Close event Outlook VBA and Custom Forms 3
R Quick Access view in File Explorer when saving attachments Using Outlook 0
R Sending emails via Outlook XP, from Windows 10 File Explorer Using Outlook 1
P Automate Outlook Start - No Active Explorer Object Found Using Outlook 10
K Macro Not Executing then send email from Explorer Outlook VBA and Custom Forms 3
I Windows 10 - .msg files on disk show Explorer popup error Using Outlook 5
M Question: Is there a rule that will save email in Windows Explorer Outlook VBA and Custom Forms 3
oliv- How to select an mailitem in explorer with "show as conversation" Outlook VBA and Custom Forms 8
Michael Chiasson PST file shows 300+MB in Windows Explorer, but only 250kb in Outlook 2010 Using Outlook 1
P Was Helvetica crashing Outlook, now fix has messed up explorer Using Outlook 4
R Outlook 2007 - drag drop email to Explorer Using Outlook 1
L cannot send email from Internet Explorer in Outlook 2003 Using Outlook 12
L Hyperlins within Outlook will not work, I have to cut and paste to internet explorer, how can this be fixed Using Outlook 1
K Exchange 2010 Health explorer on configuration, performace & security state is blank Exchange Server Administration 2
A Send to from windows explorer Using Outlook 2
M outlook view control (outlook 2010 64 bit) in internet explorer (32bit mode) Using Outlook 3
Z Error code 0x840ccc33__Cannot delete emails from INBOX of MSN Mail - Inbox- MSN Explorer when viewin Using Outlook 2
L I can not send mail through Outlook 2007. It stopped working after the last Windows security patch for outlook. I can send fine through Explorer and Using Outlook 5
M Windows Explorer locks e-mail messages when it saves them Using Outlook 7
A Emailing file attachments from windows explorer Using Outlook 5
A vb6 run time error 5 when Outlook 2007 Explorer object displayed Outlook VBA and Custom Forms 1
C Create a Ribbon for the OL2010 Explorer Outlook VBA and Custom Forms 1
E Can I hide an explorer or make an explorer modal Outlook VBA and Custom Forms 2
E Can I hide an explorer or make an explorer modal Outlook VBA and Custom Forms 2
A Active explorer issue Outlook VBA and Custom Forms 15
S How to italicize the email entry in explorer window Outlook VBA and Custom Forms 3
T Creating toolbar in new Explorer Outlook VBA and Custom Forms 3
S Strange Behaviour of Explorer Object. Outlook VBA and Custom Forms 1
R destroying Explorer object pointers on shutdown Outlook VBA and Custom Forms 2
U Not able to delete Add-in button from multiple Outlook Explorer Outlook VBA and Custom Forms 1
M Internet Explorer cannot display the webpage Using Outlook 36
M Best Strategy To Market Your Product Using Outlook 0
J What is the best EntryID format to set on MS Access table Outlook VBA and Custom Forms 3
B What is best IMAP .OST file to .PST file converter solutions? Using Outlook 1
P Best configuration for Outlook 2016, Gmail and iCloud Using Outlook 8
P Outlook room resource calendars and best practices Exchange Server Administration 0
Rupert Dragwater What is the best way to back up pst Using Outlook 4
Diane Poremsky The Best Outlook Store Add-ins Contest New Slipstick.com Articles 0
Patrick van Berkel Best way to share (and keep up-to-date) Macro's in Outlook 2010 Outlook VBA and Custom Forms 6
oliv- Best practice for catching mailitem.events Outlook VBA and Custom Forms 0
M What is the best way to find all records of an e-mail for our company? Outlook VBA and Custom Forms 2
J Best approach for restarting custom task form development after seemingly corrupt form environment Outlook VBA and Custom Forms 0
X Best utility for repairing PST files? Using Outlook 3
S Best method to use Outlook Standalone with iPhone New Slipstick.com Articles 13
D a suggestion ...sent with the best intentions Using Outlook 1
B What is the best way to use Outlook address book to select customer and then open Excel Outlook VBA and Custom Forms 22
M How best to track OUTGOING referrals? BCM (Business Contact Manager) 2
M best duplicate contact remover? Using Outlook 6
jobudge Reinstalled Outlook 2013 after system crash what is best way to synch with gmail? Using Outlook 1
M Best way to identify/designate contacts in incoming emails? Using Outlook 4

Similar threads

Top