Group:  Microsoft Outlook ยป microsoft.public.outlook.program_addins
Thread: program new toolbar in outlook with VB.NET 2003

Geek News

program new toolbar in outlook with VB.NET 2003
"Oskar Vaia" <vaia_oskar[ at ]hotmail.com> 3/1/2006 7:20:14 AM
hello,

i try to develop an addin for outlook 2003 with VB.NET 2003.
here is the code for the "connect"-class.

---
Public Class Connect

Implements Extensibility.IDTExtensibility2

Dim applicationObject as Object
dim addInInstance as object

Dim WithEvents oApplication As
Microsoft.Office.Interop.Outlook.Application
Dim WithEvents oCreateAccountBHandler As
Microsoft.Office.Core.CommandBarButton
Dim oCommandBar As CommandBar

Public Sub OnBeginShutdown(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnBeginShutdown
End Sub

Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnAddInsUpdate
End Sub

Public Sub OnStartupComplete(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnStartupComplete
MsgBox("TEST")

Dim oCommandBars As Microsoft.Office.Core.CommandBars
Dim oCommandBars2 As Microsoft.Office.Core.CommandBar
Dim oControls As Microsoft.Office.Core.CommandBarControls
Dim oControl As Microsoft.Office.Core.CommandBarButton

oCommandBars = oApplication.ActiveExplorer.CommandBars
oCommandBar = oCommandBars.Add("Account ToolBar", Temporary:=False)
oControl =
oCommandBar.Controls.Add(Type:=MsoControlType.msoControlButton, ID:=1,
Temporary:=False)
oControl.Caption = "CNA"
oControl.FaceId = 609
oControl.Style = MsoButtonStyle.msoButtonIconAndCaption
oCreateAccountBHandler = oControl
oCommandBar.Visible = True
oCommandBar.Position = MsoBarPosition.msoBarLeft

End Sub

Public Sub OnDisconnection(ByVal RemoveMode As
Extensibility.ext_DisconnectMode, ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnDisconnection
End Sub

Public Sub OnConnection(ByVal application As Object, ByVal connectMode
As Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef custom As
System.Array) Implements Extensibility.IDTExtensibility2.OnConnection
applicationObject = application
addInInstance = addInInst

End Sub

End Class
---

My Problem:
the new toolbar "Account ToolBar" doesn't appear in outlook! can someone
please help me to resolve this?

thanks

Oskar


Re: program new toolbar in outlook with VB.NET 2003
Rog <rog_21[ at ]yahoo.com> 3/1/2006 7:47:04 PM
I see in your code you have a MsgBox. does this get invoked. This would
help to ensure that you add-in is in fact being loaded properly.

Oskar Vaia wrote:
[Quoted Text]
> hello,
>
> i try to develop an addin for outlook 2003 with VB.NET 2003.
> here is the code for the "connect"-class.
>
> ---
> Public Class Connect
>
> Implements Extensibility.IDTExtensibility2
>
> Dim applicationObject as Object
> dim addInInstance as object
>
> Dim WithEvents oApplication As
> Microsoft.Office.Interop.Outlook.Application
> Dim WithEvents oCreateAccountBHandler As
> Microsoft.Office.Core.CommandBarButton
> Dim oCommandBar As CommandBar
>
> Public Sub OnBeginShutdown(ByRef custom As System.Array) Implements
> Extensibility.IDTExtensibility2.OnBeginShutdown
> End Sub
>
> Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements
> Extensibility.IDTExtensibility2.OnAddInsUpdate
> End Sub
>
> Public Sub OnStartupComplete(ByRef custom As System.Array) Implements
> Extensibility.IDTExtensibility2.OnStartupComplete
> MsgBox("TEST")
>
> Dim oCommandBars As Microsoft.Office.Core.CommandBars
> Dim oCommandBars2 As Microsoft.Office.Core.CommandBar
> Dim oControls As Microsoft.Office.Core.CommandBarControls
> Dim oControl As Microsoft.Office.Core.CommandBarButton
>
> oCommandBars = oApplication.ActiveExplorer.CommandBars
> oCommandBar = oCommandBars.Add("Account ToolBar", Temporary:=False)
> oControl =
> oCommandBar.Controls.Add(Type:=MsoControlType.msoControlButton, ID:=1,
> Temporary:=False)
> oControl.Caption = "CNA"
> oControl.FaceId = 609
> oControl.Style = MsoButtonStyle.msoButtonIconAndCaption
> oCreateAccountBHandler = oControl
> oCommandBar.Visible = True
> oCommandBar.Position = MsoBarPosition.msoBarLeft
>
> End Sub
>
> Public Sub OnDisconnection(ByVal RemoveMode As
> Extensibility.ext_DisconnectMode, ByRef custom As System.Array) Implements
> Extensibility.IDTExtensibility2.OnDisconnection
> End Sub
>
> Public Sub OnConnection(ByVal application As Object, ByVal connectMode
> As Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef custom As
> System.Array) Implements Extensibility.IDTExtensibility2.OnConnection
> applicationObject = application
> addInInstance = addInInst
>
> End Sub
>
> End Class
> ---
>
> My Problem:
> the new toolbar "Account ToolBar" doesn't appear in outlook! can someone
> please help me to resolve this?
>
> thanks
>
> Oskar
>
>
Re: program new toolbar in outlook with VB.NET 2003
"Sue Mosher [MVP-Outlook]" <suemvp[ at ]outlookcode.com> 3/20/2006 3:34:14 PM
You might want to head over to http://www.microeye.com and getthe Items Command Bar sample forom their Resources section. It is the primer on Explorer CommandBars.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Oskar Vaia" <vaia_oskar[ at ]hotmail.com> wrote in message news:u8lAXCQPGHA.2668[ at ]tk2msftngp13.phx.gbl...
[Quoted Text]
> hello,
>
> i try to develop an addin for outlook 2003 with VB.NET 2003.
> here is the code for the "connect"-class.
>
> ---
> Public Class Connect
>
> Implements Extensibility.IDTExtensibility2
>
> Dim applicationObject as Object
> dim addInInstance as object
>
> Dim WithEvents oApplication As
> Microsoft.Office.Interop.Outlook.Application
> Dim WithEvents oCreateAccountBHandler As
> Microsoft.Office.Core.CommandBarButton
> Dim oCommandBar As CommandBar
>
> Public Sub OnBeginShutdown(ByRef custom As System.Array) Implements
> Extensibility.IDTExtensibility2.OnBeginShutdown
> End Sub
>
> Public Sub OnAddInsUpdate(ByRef custom As System.Array) Implements
> Extensibility.IDTExtensibility2.OnAddInsUpdate
> End Sub
>
> Public Sub OnStartupComplete(ByRef custom As System.Array) Implements
> Extensibility.IDTExtensibility2.OnStartupComplete
> MsgBox("TEST")
>
> Dim oCommandBars As Microsoft.Office.Core.CommandBars
> Dim oCommandBars2 As Microsoft.Office.Core.CommandBar
> Dim oControls As Microsoft.Office.Core.CommandBarControls
> Dim oControl As Microsoft.Office.Core.CommandBarButton
>
> oCommandBars = oApplication.ActiveExplorer.CommandBars
> oCommandBar = oCommandBars.Add("Account ToolBar", Temporary:=False)
> oControl =
> oCommandBar.Controls.Add(Type:=MsoControlType.msoControlButton, ID:=1,
> Temporary:=False)
> oControl.Caption = "CNA"
> oControl.FaceId = 609
> oControl.Style = MsoButtonStyle.msoButtonIconAndCaption
> oCreateAccountBHandler = oControl
> oCommandBar.Visible = True
> oCommandBar.Position = MsoBarPosition.msoBarLeft
>
> End Sub
>
> Public Sub OnDisconnection(ByVal RemoveMode As
> Extensibility.ext_DisconnectMode, ByRef custom As System.Array) Implements
> Extensibility.IDTExtensibility2.OnDisconnection
> End Sub
>
> Public Sub OnConnection(ByVal application As Object, ByVal connectMode
> As Extensibility.ext_ConnectMode, ByVal addInInst As Object, ByRef custom As
> System.Array) Implements Extensibility.IDTExtensibility2.OnConnection
> applicationObject = application
> addInInstance = addInInst
>
> End Sub
>
> End Class
> ---
>
> My Problem:
> the new toolbar "Account ToolBar" doesn't appear in outlook! can someone
> please help me to resolve this?
>
> thanks
>
> Oskar
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net