That is what I am trying to do. I am also trying to understand how to build
and implement an add in. I am trying to do a simple COM add in dll to
insert an item on the tools menu. Then I was going to have the menu item
display a user form like you said and add a web browser control to a slide.
I user the
Visual Basic Editor with PPT (2002) and created an Add in
project. I created the dll and when I start PowerPoint it is marked with an
X in the COM add ins dialog but my item is not added to the menu. It seems
as if I don't get the Auto_Open() event. I have the designer Initial Load
Behavior set to startup.
Do I need to do something further to get my item added to the menu?
Code snippet:
Sub ShowForm()
MsgBox "I made it!"
End Sub
Sub Auto_Open()
Dim NewControl As CommandBarControl
' Store an object reference to a command bar.
Dim ToolsMenu As CommandBars
' Figure out where to place the menu choice.
Set ToolsMenu = Application.CommandBars
' Create the menu choice. The choice is created in the first
' position in the Tools menu.
Set NewControl = ToolsMenu("Tools").Controls.Add _
(Type:=msoControlButton, _
Before:=1)
' Name the command.
NewControl.Caption = "Show Form"
' Connect the menu choice to your macro. The OnAction property
' should be set to the name of your macro.
NewControl.OnAction = "ShowForm"
End Sub
Sub Auto_Close()
Dim oControl As CommandBarControl
Dim ToolsMenu As CommandBars
' Get an object reference to a command bar.
Set ToolsMenu = Application.CommandBars
' Loop through the commands on the tools menu.
For Each oControl In ToolsMenu("Tools").Controls
' Check to see whether the comand exists.
If oControl.Caption = "Show Form" Then
' Check to see whether action setting is set to ChangeView.
If oControl.OnAction = "ShowForm" Then
' Remove the command from the menu.
oControl.Delete
End If
End If
Next oControl
End Sub
TIA
Quote:
> Hi Mike,
> I don't quite understand what you are after. You can create userform and
ask
> the user for the URL. Then you create an instance of WebBrowser control on
> the slide with some code like:
> Set Shp = ActivePresentation.Slides(1).Shapes.Add( _
> ClassName:="Shell.Explorer")
> Set the dimensions of the shape and use Navigate method of the web browser
> object. Something like:
> Shp.OLEFormat.Object.Navigate URL
> would work. Were you looking for the appropriate methods to call?
> - Chirag
> http://officerone.tripod.com/
> > I have done some testing on creating VBA addins for PowerPoint. I
created
> a
> > limited addin that has a menu item that when selected runs a macro. The
> > macro adds a slide and then some text. What I want to do is create a
web
> > browser control( menu item? ) that a user can add to a slide, size it
and
> > set the URL property. How does one do this? Add a menu item on the tool
> bar
> > that uses user forms to collect the properties and then insert a
> WebBrowser1
> > object on the slide?
> > TIA