Use VBA to rotate an object during a show

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Powerpoint 2003.

I have a presentation that shows several objects against a polar coordinate
system.

My goal is to allow the user to interactively change the rotation angle of a
selected object by clicking on a horizontal scroll bar, during the
presentation. The scroll bar will include a display of the angle of rotation
(scrollbar value).

If it is not possible to dynamically change the angle (and redraw the
display), then I guess that an action button (macro) will be required to
redraw the display.

I understand some VBA syntax, but this level of coding is beyond my
experience.
 
John,

Thank you, it is exactly what I wanted to do.

I will have several objects on same slide, and at least three slides in the
presentation. I assume that I will need to add additional subroutines for
each object, label, and for each scollbar.

I have already modified the code to use a scroll bar vice a spin button.
(The scroll bar provides me the option of large & small increments.)
 
Try playing with a reference to the shape since you can't select it
during a slide show. This might help as a simple example that does
select the shape.

ActiveWindow.Selection.ShapeRange.IncrementRotation 334.15

Brian Reilly, MVP
 
Tom Conrad said:
John,

Thank you, it is exactly what I wanted to do.

I will have several objects on same slide, and at least three slides in the
presentation. I assume that I will need to add additional subroutines for
each object, label, and for each scollbar.

I have already modified the code to use a scroll bar vice a spin button.
(The scroll bar provides me the option of large & small increments.)

Normally you'd work with the currently selected shape, so there'd be no need
for multiple routines. But I think you could pull it off like so:

In the Declarations section:

Dim oCurrentShape as Shape

Then add this sub:

Sub SetCurrentShape(oSh as Shape)
' Get a reference to the shape the user's just clicked
Set oCurrentShape = oSh
' and for debugging porpoises (squeeek)
Msgbox oCurrentShape.Name
End Sub

Assign that macro as the action setting for any shape you intend to let the
user rotate

Finally, in the code that does the actual rotation (the click/change event for
your scroller) surround it with:

' Don't run the code if nothing's been clicked
If Not oCurrentShape Is Nothing Then

End If


That'll let the user click to "select" (kindasorta) a shape, then manipulate it
using your code.
 
Back
Top