VBA 2007: Inserting an image uses available placeholder

L

Luca Brasi

My add-in places an image onto the active slide (using Shapes.AddPicture
method).

So far so good, but I noticed that PP2007 automatically assigns the newly
inserted image to any available and empty placeholder (if the placeholder is
of an appropriate type for an image). If I remember right this worked
different in previous versions of PP. I agree that this behavior might be
reasonable in some cases but for my add-in it's very bad. I would like any
placeholders to stay untouched by my add-in.

The only workaround I see so far is to first remove all placeholder of types
that could contain an image, insert then the image in the slide and restore
all previously deleted placeholders again.

I'm wondering if there's not a much easier approach to this. Any hints are
greatly appreciated!

Thanks, Luca
 
L

Luca Brasi

Steve, thanks for sharing your thoughts on this.

What I finally did is to put a loop around the AddImage method. The loop
runs until the inserted shape is not assigned to a placeholder. At the end,
the images that were inserted before and are assigned to placeholder are
deleted again.

Quite simple but it still took me some time to figure it out.

Thanks again, Luca
 
L

Luca Brasi

Yes, the placeholders reappear automatically.
Only (very) small issue is that if a user had previously moved the
placeholder he will wonder why it gets reset to its original position... so
I'm really happy with it.

Cheers, Luca
 

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