PPT2003 VBA Centering command

T

Tom Conrad

I'm using PPT 03, and I am a VBA advanced novice (no snickering). Is there a
VBA command to postion the center a drawing object at a precise point on the
slide?

I have found the commands to position the top and left corners of an object,
but I cannot find a command to position the object's center point at a
designated point on the slide.

The drawing object is a grouped object consisting of two autshapes, an oval
(circle) and a closed freefrom line.

Thanks
TC
 
T

Tom Conrad

John,
Thanks for your reply.

I was hoping for a more elegant (simpler) solution, since PPT can center an
object at slide center in edit mode, or it can perform a relative alignment
the centers of two or more objects (also in edit mode).

I am using vba to move objects while in presentation mode. When I present
the slide, VBA controls allow me to rotate the group object. The centering
function would be part of a slide redraw subprocess.

I have observed that regardless of the actual autoshape that ppt treats all
objects as being bounded by a rectangle. Since I originally planned to rotate
the object, I ensured that the object is bounded by a square of even sides.
The even bounding ensures that the center doesn't wobble around the axis.

The offset math works great for objects that are not rotated or that have
been rotated in 90deg increments. But offset math is less accurate for
rotations at all angles not divisible by 90.
 
T

Tom Conrad

John,

I apologize for my previous post where I doubted your solution.

I checked your idea, and discovered that it does work.

I believe the problem was that my personal frame of reference wasn't aligned
with VBA's frame of reference.

As a human being I wanted to first place the object's center point at a
predetermined point and then rotate the object (essentially I wanted to shove
a pushpin thru the object's center onto the slide where i wanted the axis of
rotation to be).

Apparently, vba has its own placement priorities, in that all placements
occur from the top left corner of the rectangular container object and then
rotations or other translations are applied.

So as you correctly stated, if I apply a half-width, half-length offsets
immediately after the placement VBA command or as part of the placement
comand, then everything works out hunky dory!

(I'm uncertain that hunky dory is a vba term, but I bet if I looked really
hard thru the documentation... <chuckle>.

Thanks again,
Tom
===
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top