Macro can't find named object

A

andyjim

I've done macroing in Excel but not PPT. The project is sheets of ten 2x4 jar
labels. I have the slide set up as I want, and it prints out fine. Now to
make a slide for a new product, using the previous slide as a template. I
reworked one label on the template, then I recorded a macro to copy/paste
that one to the remaining nine labels on the slide (deleting each in turn and
replacing it with a copy of the new label). Now I want the macro to help me
make another slide with another product label, same size, etc. So I reworked
the first label on the new slide, then ran the macro. It cannot find the
objects named in the recorded macro, I presume since the object names are
those on the original slide where I recorded the macro.
How can I make a generic macro that will do the same work in a different
slide?
 
D

David Marcovitz

I've done macroing in Excel but not PPT. The project is sheets of ten 2x4 jar
labels. I have the slide set up as I want, and it prints out fine. Now to
make a slide for a new product, using the previous slide as a template. I
reworked one label on the template, then I recorded a macro to copy/paste
that one to the remaining nine labels on the slide (deleting each in turn and
replacing it with a copy of the new label). Now I want the macro to help me
make another slide with another product label, same size, etc. So I reworked
the first label on the new slide, then ran the macro. It cannot find the
objects named in the recorded macro, I presume since the object names are
those on the original slide where I recorded the macro.
How can I make a generic macro that will do the same work in a different
slide?

Post your code, and it will be easier to help you.

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland
 
A

andyjim

OK, here is a portion of the code, the rest being just more of the same type
of operation on additional boxes. I didn't write this.It was a
keystroke-derived macro. When I go to a slide other than the one where I made
the macro and run it to accomplish the exact same task only in a different
slide it bombs and says it can't find the named object. Since the text boxes
are specifically named, I'm presuming that is why. I'd like to write a macro
that will do a series of these operations on any slide.

The objects in the slide are jar labels. When I make a new label on a new
slide (for a different flavor, for example) I want to do the exact same set
of operation that I macro-ed on the previous slide (same size label, just
different textual content).

ActiveWindow.Selection.SlideRange.Shapes("Text Box 57").Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
ActiveWindow.Selection.ShapeRange.Delete
ActiveWindow.View.Paste
With ActiveWindow.Selection.ShapeRange
.IncrementLeft 304.5
.IncrementTop -288.75
End With
ActiveWindow.Selection.SlideRange.Shapes("Text Box 58").Select
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select
ActiveWindow.Selection.ShapeRange.Delete
ActiveWindow.View.Paste
With ActiveWindow.Selection.ShapeRange
.IncrementLeft 304.5
.IncrementTop -148.5
End With
 
A

andyjim

I took this question to a new thread titled: Macro to arrange labels on
slide. I think I've done a better job there of describing what I'm after. But
I'll watch both threads for replies.
 

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