This is strange
sngRight = oSh.Left + oSh.Width
'Change the height/width
' then
oSh.Left = sngRight - oSh.Width
Dont you mean
oSh.Width = oSh.Width * .5
oSh.Height = oSh.Height * .5
Surley that is what I do to change the size of this mysterious shape
that I don't know what it is as I am a beginner to this
And that goes for the mysterious collection object that I don't know
anything about.
Does this shape object have to act as a container for the picture. If
so should I not have to add a shape to the slide(8) and set the
picture to it.? What part of I do not know what this shape object is
does nobody here understand.
OK, after responding, I just found the rest of this thread. I didn't realize
that you had been banging this around with Steve. Here are some basics, but
you might want to look into a reference about all of this to get some basic
background (see my book and/or the Programming PowerPoint section of
http://www.pptfaq.com/).
Each slide consists of a Shapes collection. All the stuff (pictures, lines,
text boxes, circles, etc.) are part of the Shapes collection. You access the
Shapes collection of a particular slide, e.g. slide 8, with:
ActivePresentation.Slides(8).Shapes
If you want to access a specific shape, you can do it by number or name. For
example, if you want to access the 4th shape on the 8th slide, you need:
ActivePresentation.Slides(8).Shapes(4)
The problem is that you have no easy way of telling which shape is which.
The other problem is that the shape numbers can change (e.g., delete shape 3
and all the shapes with higher numbers move down so the old number 4 is now
number 3). That is why it tends to be better to use shape names.
Shape names are names that PowerPoint uses for the shapes. They have nothing
to do with the file names from where a picture comes. By default, PowerPoint
assigns a name to a shape when it gets inserted onto a slide (it usually
looks something like "AutoShape 2" or "Picture 5"). So, if you know the name
of the picture is Picture 5, you can change the above line to:
ActivePresentation.Slides(8).Shapes("Picture 5")
But you won't easily know what the name of the picture is. That is why you
probably want to change the name. In my earlier post, I suggested using the
code on my site in Example 8.7. Now, you can change the name of that picture
to whatever you want. Change it My Mother, and your code should be:
ActivePresentation.Slides(8).Shapes("My Mother")
That would be the pointer to the shape/picture that you want to manipulate.
Steve had suggested putting this into a variable so your code doesn't fill
up with references to
ActivePresentation.Slides(8).Shapes("My Mother")
Instead, just make a variable that points to the shape:
Set oSh = ActivePresentation.Slides(8).Shapes("My Mother")
Now, in your macro, whenever you want to refer to the picture, just use oSh
instead.
So, now that we have a nice shorthand for the picture, you can adjust the
properties of the picture, such as its Top, Left, Width, and Height
properties.
oSh.Top = 0
Moves the picture to the top of the slide.
oSh.Width = 50
makes the picture 50 pixels wide (and probably auto-adjusts the height,
depending on the value of another property that I can't remember off the top
of my head).
Something like:
oSh.Width = oSh.Width * .5
should cut the width of the picture in half (and possibly the height).
This should be enough to allow you to play with various settings to adjust
the location and size of your picture. Once you have the macro written,
assign it to a button, run the presentation in Slide Show view and click on
the button to watch your picture change. You might want another macro that
puts the picture back the way it was to start, also.
--David
--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland