![]() |
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,
My mail goal is to make sure that each and every outlook window must have one and one add-in toolbar. The temporary type add-in toolbar works fine but has below limitations: 1. If you hide or reposition the tool bar, it changes to default again when you restart the outlook. 2. Possibility of missing or duplicat toolbar from/on outlook window. See below example where toolbar can be missed. -- Just open Outlook, you have "My button". -- Then open Calender in new windows. Everything works fine. -- Now close Outlook window first and then calender window. -- Again open Outlook. It will open two windows Outlook and Calender and you will have two toolbars on Outlook window and no toolbar on calender window. I tried with permanent type add-in toolbar also but facing other issues. see https://www.microsoft.com/office/com...r=US&sloc=&p=1 Could any one please help me to sort out this issues. 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() 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, True) Set MyButton = MyCommandBar.Controls.Add(msoControlButton, , "890", , True) 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 |
Ads |
#2
|
|||
|
|||
![]() Why don't you test whether your toolbar exists already? And as to the position, you need to store that anywhere, for instance, in the registry, and reload it when you create the toolbar. -- Best regards Michael Bauer - MVP Outlook Manage and share your categories: http://www.vboffice.net/product.html?pub=6&lang=en Am Tue, 15 Dec 2009 01:46:02 -0800 schrieb paresh: Hi, My mail goal is to make sure that each and every outlook window must have one and one add-in toolbar. The temporary type add-in toolbar works fine but has below limitations: 1. If you hide or reposition the tool bar, it changes to default again when you restart the outlook. 2. Possibility of missing or duplicat toolbar from/on outlook window. See below example where toolbar can be missed. -- Just open Outlook, you have "My button". -- Then open Calender in new windows. Everything works fine. -- Now close Outlook window first and then calender window. -- Again open Outlook. It will open two windows Outlook and Calender and you will have two toolbars on Outlook window and no toolbar on calender window. I tried with permanent type add-in toolbar also but facing other issues. see https://www.microsoft.com/office/com...r=US&sloc=&p=1 Could any one please help me to sort out this issues. 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() 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, True) Set MyButton = MyCommandBar.Controls.Add(msoControlButton, , "890", , True) 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 |
Problem in permanent type add-in toolbar | paresh | Outlook and VBA | 6 | December 17th 09 04:39 AM |
Toolbar problem | lencastro | Add-ins for Outlook | 1 | May 27th 07 10:27 PM |
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 | its_my_dime | Outlook - General Queries | 0 | December 26th 06 09:09 PM |