![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hi, I have been facing a issue with dealing with my add-in toolbar. I want to
make my toolbar permanent so that use can hide and reposition it permanently(even after restarting Outlook). At the same time, I want to support my add-in toolbar for all opened Outlook explorer. I want to make sure that at any point of time there must be one and only one toolbar on any Outlook window. I have tried below methods but none worked: 1. Tried deleting toolbar on shutdown. This doesn't delete the toolbar and each restarting outlook adds new toolbar. Private Sub AddinInstance_OnBeginShutdown(custom() As Variant) MyCommandBar.Delete End Sub Private Sub AddinInstance_Terminate() MyCommandBar.Delete End Sub 2. I tried deleting toolbar on Explorer close event but didn't work. Whenever I open Outlook folder by right clicking it and selecting "Open in new window", it keep adding new toolbar but does't delete. Private Sub myExpl_Close() MyCommandBar.Delete If out_appt.Explorers.Count 1 Then Set myExpl = Nothing Set myColExpl = Nothing End If End Sub 3. Tried checking existence of toolbar but this will not add toolbar when I right click on outlook folder and open in new window. Set MyCommandBar = myExpl.CommandBars.Item(TOOLBARNAME) If Not MyCommandBar Is Nothing Then MsgBox "exists" Exit Sub End If Could anyone please help me here. I think if I can do any of below then I would all set he 1. Delete existing toolbar while closing explorer event 2. Check the existing of toolbar explorer wise. Though I am setting myExpl to currently active explorer, my code always returns true for "myExpl.CommandBars.Item(TOOLBARNAME)" whenever I open outlook folder in new window. Thanks. === MY CODE === Option Explicit Public out_appt As Outlook.Application Public WithEvents MyButton As Office.CommandBarButton Public MyCommandBar As Office.CommandBar Public WithEvents myColExpl As Outlook.Explorers Public WithEvents myExpl As Outlook.Explorer Private Sub AddinInstance_OnConnection(ByVal Application As Object, _ ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ ByVal AddInInst As Object, custom() As Variant) Set out_appt = Application End Sub Private Sub AddinInstance_OnStartupComplete(custom() As Variant) Set myColExpl = out_appt.Explorers If out_appt.Explorers.Count 0 Then Call CreateToolBar End If Exit Sub End Sub Private Sub myColExpl_NewExplorer(ByVal Explorer As Outlook.Explorer) If myExpl Is Nothing Then Set myExpl = Explorer End If If out_appt.Explorers.Count 0 Then Call CreateToolBar End If End Sub Private Sub myExpl_Close() MyCommandBar.Delete If out_appt.Explorers.Count 1 Then Set myExpl = Nothing Set myColExpl = Nothing End If End Sub Private Sub MyButton_Click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean) On Error Resume Next MsgBox "button clicked" End Sub Private Sub CreateToolBar() If out_appt.Explorers.Count = 0 Then Exit Sub End If Set myExpl = out_appt.ActiveExplorer Const TOOLBARNAME = "My Toolbar" ' Set MyCommandBar = myExpl.CommandBars.Item(TOOLBARNAME) ' If Not MyCommandBar Is Nothing Then ' MsgBox "exists" ' Exit Sub ' End If ' Set MyCommandBar = myExpl.CommandBars.Add(TOOLBARNAME, msoBarTop, False, False) Set MyButton = MyCommandBar.Controls.Add(msoControlButton, , "890", , False) With MyButton .Caption = "&Foo Button" .Enabled = True .OnAction = "!PermToolbarTesting.Connect" .Tag = "890" .FaceId = 362 .Style = 3 .Visible = True End With MyCommandBar.Visible = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Toolbar problem -Help | lencastro | Add-ins for Outlook | 0 | May 25th 07 11:27 AM |
Toolbar problem -Help | lencastro | Add-ins for Outlook | 0 | May 25th 07 11:20 AM |
Problem when adding new toolbar on NewInspector when editor type in Word - Outlook 2003 | Harry | Add-ins for Outlook | 3 | March 26th 07 02:25 PM |
Problem when adding new toolbar on NewInspector when editor type is Word - Outlook 2003 | Harry | Outlook - General Queries | 1 | February 7th 07 02:06 PM |
Toolbar problem | Lesley | Outlook Express | 7 | August 30th 06 10:19 AM |