Placeholders with BATCH IMPORT vba

D

Dan S.

The BATCH IMPORT vba routine works like a dream. Is there a way to edit the
code so that it will always insert the pictures in the placeholder? Right now
it drops the jpeg on top of everything--keeping everything a consistent size
would be a snap if it knew to use the placeholder.
Thanks
 
D

David M. Marcovitz

Look at the parts of the routine that are commented out. They can make the
picture a specifc size. The two that are there are to make it fill the screen
with or without distorting the picture, but you could set the picture to any
size:

With oPic
.LockAspectRatio = msoFalse
.height = 139
.width = 272
End With

This sets the pictures to all be 139 pixels tall and 272 wide (change the
numbers to get some other size. Remove the .LockAspectRatio line and either
the .height or .width line if you want to keep the picture from distorting.
Add lines, such as:

..left = 160
..top = 250

to place the picture in a specific spot.

Sorry, none of this answers the question of getting it into the placeholder.

--David

David Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
D

Dan S.

Thanks. That is what I'm doing now.
The only hitch is that if the jpegs are not all the same size, the small
ones get distorted when they are stretched (and vice versa).
I suppose I could add a routine that determines the current dimensions of
the jpeg and either resizes it or leaves it as is.
 
D

David M. Marcovitz

The .LockAspectRatio = msoFalse line allows the picture to be distorted. If
you don't want distortions then make that .LockAspectRatio = msoTrue so it
can't be distorted.

As far as stretching, you would have to check the original size and make
sure that the size you want isn't "too big" by however you define that (e.g.,
is the preferred size more than twice the height and/or width of the
original). If you can define "too big" mathematically, then the code is easy.

I'm not sure how dumping it into a placeholder would help either of these
problems because the placeholder is going to be a specific size so some
pictures will either get distorted or stretched with that method.

--David

David Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 

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