Macro to arrange labels on slide

A

andyjim

I've made a PPT slide of ten 2"x4" jar labels to print. The slide format
simulates an Avery template for printing labels in Word (2 columns of 5
labels each), but since Word won't do everything I want, I'm doing it in PPT.
I have a successful slide that prints fine on the Avery label sheet, so now I
want to speed up the process of making other slides, different flavors, of
the same size and style label.

My manual method is to complete one new label at the top left position on
the slide, then copy paste it to the other nine positions snapping to the
guides for accurate placement. Each label is composed of several text boxes
plus a background color, so I stretch a rectangle around the entire label to
select and copy it. This works fine, so I recorded a macro to automate it for
making a new label slide, but the recorded macro seems to look for objects of
the exact names as the example objects used when I recorded the macro, and it
doesn't find those object names when I start a new label slide, so it bombs
out.
Apparently I need to find a way to work with the objects by their location
on the slide (or some other alternate method) rather than by name. I've done
some VBA work in Excel, but not in PPT. Haven't found the answer in help file
as yet.
 
A

andyjim

Just one dumb question: How do I group the sample label? It will always be in
the top left hand position, so if I could group all the objects in that
geographical range that would do it I reckon. But don't know how to do that
in VBA.
What units are the positioning numbers? Could I define the area from which
to group the sample label objects using those positioning numbers?
Alternatively could I simply group all the objects on the slide, all of them
being in the sample label?
Here's a macro that works (made by recording it then tweaking slightly), but
I have to select (by boxing it) the sample label, then run the macro. I can
continue doing that, but would prefer to have a macro do the initial
selecting also.

ActiveWindow.Selection.Copy
ActiveWindow.View.Paste
With ActiveWindow.Selection.ShapeRange
.IncrementLeft -12#
.IncrementTop 132#
End With
ActiveWindow.View.Paste
With ActiveWindow.Selection.ShapeRange
.IncrementLeft -12#
.IncrementTop 276#
End With
ActiveWindow.View.Paste
With ActiveWindow.Selection.ShapeRange
.IncrementLeft -12#
.IncrementTop 420#
End With
ActiveWindow.View.Paste
With ActiveWindow.Selection.ShapeRange
.IncrementLeft -12#
.IncrementTop 564#
End With
ActiveWindow.View.Paste
With ActiveWindow.Selection.ShapeRange
.IncrementLeft 290#
.IncrementTop -12#
End With
ActiveWindow.View.Paste
With ActiveWindow.Selection.ShapeRange
.IncrementLeft 290#
.IncrementTop 132#
End With
ActiveWindow.View.Paste
With ActiveWindow.Selection.ShapeRange
.IncrementLeft 290#
.IncrementTop 276#
End With
ActiveWindow.View.Paste
With ActiveWindow.Selection.ShapeRange
.IncrementLeft 290#
.IncrementTop 420#
End With
ActiveWindow.View.Paste
With ActiveWindow.Selection.ShapeRange
.IncrementLeft 290#
.IncrementTop 564#
End With
End Sub
 

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