VBA question Picture scaling

R

Rob

Hello all,
I found out how to place pictures on a powerpoint slide using this VBA-code:


ppApp.ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:=MyPICTUREPATH,
LinkToFile:=False, SaveWithDocument:=True, Left:=100, top:=220,
Width:=100).Select

The problem i encounter is that the picture is scaled to width=100 and
heigth is not scaled.
I would like the picture to scale proportionally to a width of 100 and a
height proportional with the width (so the picture is not distorted).
Can anyone help me?

Thank, Rob
 
J

John Wilson

I'll try again with the line breaks set better!

Set opic = ActiveWindow.Selection.SlideRange.Shapes.AddPicture _
(FileName:=MyPICTUREPATH, LinkToFile:=False, SaveWithDocument:=True, _
Left:=100, Top:=220)
opic.LockAspectRatio = msoTrue
opic.Width = 100
--
Amazing PPT Hints, Tips and Tutorials

http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
 
R

Rob

Hello John, thanks for replying.

It gives me error 424 Object required
I must declare the opic as what kind of object?
 
R

Rob

Never mind my other question, ;;;
Your solution works perfect, thanks...
(just i typing mistake...)
 

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