Thanks for answer! Code is as following!
'========================
Dim WithEvents buttonHello As Office.CommandBarButton
Private Sub IDTExtensibility2_OnConnection(ByVal Application As Object,
ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst
As Object, custom() As Variant)
Dim objCommandBar As Office.CommandBar
Dim objCommandBarSlide As Office.CommandBar
Set objBar = oApp.CommandBars
For Each objCommandBar In objBar
If objCommandBar.Name = "Slide Show" And objCommandBar.Type = 2 Then
Set objCommandBarSlide = objCommandBar
Exit For
End If
Next
With objCommandBarSlide
Set buttonHello = .Controls.Add(Type:=msoControlButton)
With buttonHello
.FaceId = 10
.Style = msoButtonIconAndCaption
.Caption = "Hello"
.Enabled = True
.Visible = True
End With
End With
End Sub
Public Sub buttonHello_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
MsgBox "me click"
End Sub
'========================
I can see buttom Item "Hello" in slide show menu, but if I slide show and
right-click "slide show" menu, then click "Hello" button it, It is nothing
happen! I hope we can see Msgbox "me clikc", Can u tell me why I can't see
this msgbox? Thanks
--
Best Regards
Steven
Post by Steve RindsbergPost the code you use to add the button and also the code the button's supposed
to invoke.
You should also understand that your button will only work reliably on your own
computer and only when the PPT file containing the OnAction code is currently
open.
In short, this isn't really the way to add buttons to toolbars if you expect
them to work well.
Instead, you want to create an add-in.
Creating and Installing Add-ins, Toolbars, Buttons
http://www.pptfaq.com/index.html#name_Creating_and_Installing_Add-ins-_Toolbars
Post by Steve Rindsberg-_Buttons_
Post by StevenI write a macro and add a button item "Hello" in powerpoint's Standard
toolbar, and assign
onAction property(a function name), after i add it, why is it disable? I
don't click it!
but if I add the buttom in "slide show" popup menu, It works, I don't know
reason! I write it with macro!
If I write code with vb, then compile it, I define "
Dim WithEvents buttonHello As Office.CommandBarButton", It doesn't work for
add button item
in "slide show" popup menu, I am very confused!
Please help me, Thanks
--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================