A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

automatically show/hide toolbar



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 4th 08, 03:37 PM posted to microsoft.public.outlook.program_vba
Peter T
external usenet poster
 
Posts: 5
Default automatically show/hide toolbar

Hi,

A 3rd party AV app has created a toolbar that displays permanently. But it's
only useful in Mail view

Is it possible to make it visible when mail view is activated and not
visible in all other views (say when mail view is de-activated or any other
view activated),

TIA,
Peter T


  #2  
Old November 4th 08, 04:12 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default automatically show/hide toolbar

What version of Outlook?

You can get the CommandBars collection for the ActiveExplorer object and
iterate that collection looking for the toolbar by name. Then you can use
the Visible property of the CommandBar object to set visibility to true or
false based on the ActiveExplorer.CurrentFolder.DefaultItemType property.
For mail items that property would be olMailItem.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Peter T" peter_t@discussions wrote in message
...
Hi,

A 3rd party AV app has created a toolbar that displays permanently. But
it's only useful in Mail view

Is it possible to make it visible when mail view is activated and not
visible in all other views (say when mail view is de-activated or any
other view activated),

TIA,
Peter T


  #3  
Old November 4th 08, 04:36 PM posted to microsoft.public.outlook.program_vba
Peter T
external usenet poster
 
Posts: 5
Default automatically show/hide toolbar

Hi Ken,

Outlook 2003 (sorry I should have said)

I've got this far

Dim cb As CommandBar
Set cb = Application.ActiveExplorer.CommandBars("ESET Smart Security")

Does changing the current folder trigger some event in which the visible
property of the commandbar can be changed, or is there some other way to do
it.

Regards,
Peter T

"Ken Slovak - [MVP - Outlook]" wrote in message
...
What version of Outlook?

You can get the CommandBars collection for the ActiveExplorer object and
iterate that collection looking for the toolbar by name. Then you can use
the Visible property of the CommandBar object to set visibility to true or
false based on the ActiveExplorer.CurrentFolder.DefaultItemType property.
For mail items that property would be olMailItem.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Peter T" peter_t@discussions wrote in message
...
Hi,

A 3rd party AV app has created a toolbar that displays permanently. But
it's only useful in Mail view

Is it possible to make it visible when mail view is activated and not
visible in all other views (say when mail view is de-activated or any
other view activated),

TIA,
Peter T




  #4  
Old November 4th 08, 05:10 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default automatically show/hide toolbar

To detect when a folder is switched in the Explorer you'd use the
Explorer.BeforeFolderSwitch() event. That passes you NewFolder As Object,
where NewFolder is the folder being switched to.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Peter T" peter_t@discussions wrote in message
...
Hi Ken,

Outlook 2003 (sorry I should have said)

I've got this far

Dim cb As CommandBar
Set cb = Application.ActiveExplorer.CommandBars("ESET Smart Security")

Does changing the current folder trigger some event in which the visible
property of the commandbar can be changed, or is there some other way to
do it.

Regards,
Peter T


  #5  
Old November 4th 08, 05:39 PM posted to microsoft.public.outlook.program_vba
Peter T
external usenet poster
 
Posts: 5
Default automatically show/hide toolbar

OK I think I've got it (this is 1st time I've ever opened Outlook's VBE)


' ThisOutlookSession

Dim c As clsExplorer

Private Sub Application_Startup()
Set c = New clsExplorer
Set c.exp = Application.ActiveExplorer

End Sub


' code in clsExplorer

Public WithEvents exp As Explorer

Private Sub exp_BeforeFolderSwitch(ByVal NewFolder As Object, Cancel As
Boolean)
Dim bVis As Boolean
Dim cb As CommandBar

On Error GoTo errH
Set cb = Application.ActiveExplorer.CommandBars("ESET Smart Security")
bVis = NewFolder.DefaultItemType = olMailItem
cb.Visible = bVis
errH:
End Sub


Just curiosity, how do other toolbars toggle visibility depending on the
current view. IOW wondering if perhaps there is some way of associating a
custom toolbar with a particular view and avoiding VBA.

Thanks again,
Peter T



"Ken Slovak - [MVP - Outlook]" wrote in message
...
To detect when a folder is switched in the Explorer you'd use the
Explorer.BeforeFolderSwitch() event. That passes you NewFolder As Object,
where NewFolder is the folder being switched to.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Peter T" peter_t@discussions wrote in message
...
Hi Ken,

Outlook 2003 (sorry I should have said)

I've got this far

Dim cb As CommandBar
Set cb = Application.ActiveExplorer.CommandBars("ESET Smart Security")

Does changing the current folder trigger some event in which the visible
property of the commandbar can be changed, or is there some other way to
do it.

Regards,
Peter T




  #6  
Old November 4th 08, 06:55 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default automatically show/hide toolbar

Other custom toolbars do exactly what you're doing, except they usually do
it in a COM addin and not the Outlook VBA project. Outlook does the same
thing, but it uses Extended MAPI code in C++ instead of using the Outlook
and Office object models.

Good job on a first effort.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Peter T" peter_t@discussions wrote in message
...
OK I think I've got it (this is 1st time I've ever opened Outlook's VBE)


' ThisOutlookSession

Dim c As clsExplorer

Private Sub Application_Startup()
Set c = New clsExplorer
Set c.exp = Application.ActiveExplorer

End Sub


' code in clsExplorer

Public WithEvents exp As Explorer

Private Sub exp_BeforeFolderSwitch(ByVal NewFolder As Object, Cancel As
Boolean)
Dim bVis As Boolean
Dim cb As CommandBar

On Error GoTo errH
Set cb = Application.ActiveExplorer.CommandBars("ESET Smart Security")
bVis = NewFolder.DefaultItemType = olMailItem
cb.Visible = bVis
errH:
End Sub


Just curiosity, how do other toolbars toggle visibility depending on the
current view. IOW wondering if perhaps there is some way of associating a
custom toolbar with a particular view and avoiding VBA.

Thanks again,
Peter T


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide Send/Receive button in Standard Toolbar - Outlook 2003 Aaron Hammond Outlook - Installation 3 June 5th 07 01:34 PM
What event gets fired when i show/hide my outlook toolbar Gautam Outlook and VBA 1 July 12th 06 03:21 PM
Programmatically show or hide folder list pane BenL712 Outlook and VBA 3 June 14th 06 04:13 PM
Tasks and Errors box won't hide automatically Mike W Outlook Express 8 February 10th 06 03:13 PM
how do I show the subject but hide the text of a meeting ? debbied Outlook - Calandaring 0 February 7th 06 04:07 PM


All times are GMT +1. The time now is 09:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.