If you're building an add-in, you use VB.NET. Did you look at the sample I suggested? Pay attention in particular to the InitHandler procedure.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
"Rudy" wrote in message ...
I can only see a reference to the ActiveExplorer object in VBA. I don't see a
reference for it in VB.NET and I think this is my problem. Do I use VBA to
add the button to the Tools item or is there a way to use VB.NET?
"Sue Mosher [MVP-Outlook]" wrote:
This definitely is your problem:
objCommandBars = applicationObject.CommandBars
Your code should check to see whether an ActiveExplorer object exists and, if it does, use its CommandBars.
"Rudy" wrote in message ...
The following is the code I have which is meant to add the item.
Public Sub OnStartupComplete(ByRef custom As System.Array) Implements
Extensibility.IDTExtensibility2.OnStartupComplete
' *** BEGIN CUSTOM CODE. ***
Dim objCommandBars As CommandBars
Dim objCommandBar As CommandBar
Dim objCommandBarControl As CommandBarControl
' Create a menu command on the "Tools" menu.
objCommandBars = applicationObject.CommandBars
objCommandBar = objCommandBars.Item("Tools")
' Make sure menu command doesn't already exist.
For Each objCommandBarControl In objCommandBar.Controls
If objCommandBarControl.Caption = "Slides from Graphics..." Then
objCommandBar.Controls.Item("Slides from
Graphics...").Delete()
End If
Next objCommandBarControl
objCommandBarButton = objCommandBar.Controls.Add(msoControlButton)
With objCommandBarButton
.Caption = "New Slides from Graphics..."
.Style = msoButtonCaption
.Tag = "Slides from Graphics..."
.OnAction = "!PowerPointAddIn.Connect"
.Visible = True
End With
' *** END CUSTOM CODE. ***
End Sub
I will investigate using the Explorer object.
"Sue Mosher [MVP-Outlook]" wrote:
It might help if you showed the code snippet that adds the new control(s). Remember that in Outlook, CommandBars are a property of the Explorer object, not Application. The sample at http://msdn2.microsoft.com/en-us/library/Aa155703 is good for shared add-ins.
"Rudy" wrote in message ...
Still having problems with this. The item does not show up on the Tools menu
in Outlook 2007. I looked at this code here
http://msdn.microsoft.com/archive/de...ce06062002.asp
and copied it into an empty VB.NET 2005 COM project but when I run it the
item I wnat still does not appear!! Have you any more examples? Thanks in
advance!
"Sue Mosher [MVP-Outlook]" wrote:
CommandBar.Controls.Add is the method you use to add new items to any CommandBar in the Explorer.CommandBars collection.
"Rudy" wrote in message news
Does anyone know how to do this? I have seen code on anding additional Menu,
but not how to add items to existing ones. Thanks in advance!