Powerpoint attaching a VBA function on a button -
i have found how create button , want make when press it following function.
<-button->
sub addbutton() dim cb commandbar set cb = application.commandbars.add("additional_toolbar", msobartop, , true) cb.controls.add(msocontrolbutton) .caption = "click me" .onaction = "macro_name" .style = msobuttoncaption end cb.visible = true end sub
<-action want perform->
sub copysizeandposition() ' usage: select 2 shapes. size , position of ' first shape selected copied second. dim w double dim h double dim l double dim t double activewindow.selection.shaperange(1) w = .width h = .height end activewindow.selection.shaperange(2) .width = w .height = h end end sub
do u know how that?
change:
.onaction = "macro_name"
to:
.onaction = "copysizeandposition"
Comments
Post a Comment