How do I determine the image file used for a fill in code?

  • Thread starter Thread starter MrBo
  • Start date Start date
M

MrBo

All
I'm trying to programmatically determine which image file is currently being
used to fill an autoshape.
I can set this file for an autoshape but so far have been unable to read
this filename in code.
Any help gratefully appreciated.

Menu:-
Select autoshape, right click-Format Autoshape-Colors and Lines
tab-Fill-Color:-Fill Effects-Picture Tab-Select Picture
 
I could be wrong, but I think that unless you use code to put the picture
in, you have no way of knowing that information. PowerPoint embeds the
picture, so it doesn't need any information about the original file.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
If you just want the name, double-click the AutoShape to summon the Format
AutoShape dialog box.

Then choose the Colors and Lines tab and click the downward pointing arrow
for the Fill Color and choose Fill Effects in the flyout menu.

Then choose the Picture tab in the Fill Effects dialog box. Right below the
picture, you'll find the name of the picture.
 
You are out of luck there. This is something which was surprisingly left out
from the object model. Though you cannot determine which file was used, you
can extract the original image from with PowerPoint (2000+) by using the
hidden Export method for a shape.

Interestingly, when you use the Export method on the shape with a user
background picture/texture fill (Same as right-click on shape| Saves as
picture...) to export it as *EMF*, you get the original image that was used
to provide the background fill and not an export of the complete shape. Any
other format and you will get the PowerPoint shape. A bug which can be used
to your benefit.

Call ActiveWindow.Selection.ShapeRange(1).Export("E:\test\test.emf",
ppShapeFormatEMF)

--
Regards,
Shyam Pillai

Animation Carbon: http://skp.mvps.org/ac/
 

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

Back
Top