Position of custom toolbar buttons ?

  • Thread starter Thread starter noone
  • Start date Start date
N

noone

Hello all,
Below is a snippet of code that I using in my first attempt at a COM object.
All is working fine, my question is how do I control the placement of the
custom toolbar, i.e. now it is right after the New button.

I would like to have it go after the users 'Organize' button, or if not
present
at the end of the Standard toolbar.

I've been googlin for an hour now, any help is appreciated.
Thanks.

Dim oExp As Outlook.Explorer
Dim oBar As Office.CommandBar

Set oExp = Outlook.ActiveExplorer
Set oBar = oExp.CommandBars.Item("Standard")

Set myControl = oBar.FindControl(, , "Unsolicited")

If myControl Is Nothing Then
Set myControl = oBar.Controls.Add(, , , 2, True)
With myControl
.Caption = "Unsolicited"
.FaceId = 67
.Style = msoButtonIconAndCaption
.Tag = "Unsolicited"
.Visible = True
End With
End If
 
Set myControl = oBar.FindControl(, , "Organize")
If Not myControl Is Nothing Then
lngPos = myControl.Index + 1
Else
lngPost = 0
End If

'create the custom control here and use
If lngPos <> 0 Then
Set myControl = oBar.Controls.Add(, , , lngPos, True)
Else
Set myControl = oBar.Controls.Add(, , , , True)
End If

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
 
Back
Top