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.
Thread starter Similar threads 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
M when acessing Ebay to answer questions, internet explorer aborts. please help as I can not run my store. thank you Using Outlook 1
V Cannot send an Internet Explorer page directly through Outlook 2010 Using Outlook 2
F cannot send an internet explorer page directly through outlook 2010 Using Outlook 1
A Email folders from windows explorer in WIN7 using MSOutlook Using Outlook 3
A Emailing file attachments from windows explorer Using Outlook 5
I Exchange 2003 OWA 401 Error: Access is Denied from Internet Explorer Using Outlook 5
L Internet Explorer freezes when I click on a link in Outlook Using Outlook 1
L can't connect from hyperlink in email received to the location on Internet Explorer Using Outlook 4
I I want open links in emails in Outlook 2007 in Firefox, not Internet Explorer Using Outlook 1
G Can't Unhide *.pst files in Explorer Using Outlook 1
F Internet Explorer 64 bit works, MS Office Outlook doesn't. Can anyone explain? Using Outlook 0
S Transfer of URL in e-mail to Internet Explorer 8 errors out Using Outlook 0
R Outlook WebApp in exchange 2010 stopped working Internet Explorer cannot display the webpage Exchange Server Administration 1
N Exchange 2007, Internet Explorer 8 and OWA: Error when reply to message is sent Using Outlook 1
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
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
Similar threads


















































Top