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

Problem in temporary type toolbar



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 15th 09, 09:46 AM posted to microsoft.public.outlook.program_vba
paresh
external usenet poster
 
Posts: 66
Default Problem in temporary type toolbar

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  
Old December 15th 09, 04:27 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Problem in temporary type toolbar



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
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
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


All times are GMT +1. The time now is 11:30 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.