How do I reference master slides in a macro?

L

Liva

Hello!

I am struggled with a task that should be pretty easy, but can't find
how to reference the objects i intend to change. I am trying to write a
VB macro, that would create a new presentation according to the custom
structure defined in an outlined three of four levels' list (the list
could be prepared in any format - currently i use excel). The first
level defines the section. The second level defines subsection. The
third level defines sub-subsection etc.

The code should:
- change the particular text box in several slide master slides of this
presentation to the names of first level items - so as a result I have
one design template for one section.
- add the necessary number of slides for each first level section - and
apply the respective design template to each of these slides
- change the text boxes in the added slides to the names of the sub and
sub-sub sections.

I struggle with the first two tasks. For the first, I cannot find a
way, how to change a text box in a master slide, which is not the first
slide - that is, cannot find, how to reference the needed master slide.

For the second, how can i write the code to apply the particular design
to a particular slide, if the current presentation has 10 different
master slides.


Will be really thankful for any help or clues!
Best, Liva
 
S

Steve Rindsberg

I struggle with the first two tasks. For the first, I cannot find a
way, how to change a text box in a master slide, which is not the first
slide - that is, cannot find, how to reference the needed master slide.

Look at the .Designs collection

For example:

With ActivePresentation.Designs(1).SlideMaster.Shapes("MyShapeName")
' do stuff
End with
For the second, how can i write the code to apply the particular design
to a particular slide, if the current presentation has 10 different
master slides.

Another example:
' apply the second design to slide 1
ActivePresentation.Slides(1).Design = ActivePresentation.Designs(2)
 
L

Liva

thanks a lot! This was exactly what I needed. :) Just had to search in
the right place and with right keywords. If you can't find an answer,
you have to think what is wrong with your question - the lesson for me
from this time.
 
C

ciw2otv

Steve said:

A new one to me also. Looked in all of the libraries, references,
classes, etc. and couldn't find it. Shyam must be taking on a license
to spice things up! Great knowledge, articulate, and a sprinkling of
 

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