Extracting a picture from a slide

T

T Lavedas

I'm building an application that extracts information from an existing
presentation. I want all the text and the image off of the first
slide. I have the text part down, but am frustrated in trying to get
a copy of the image.

The "Export Shapes as graphics" item at PPTFAQ.com suggested the use
of this code:

Call ActiveWindow.Selection.ShapeRange(1).Export( _
"C:\Workarea\filename.gif", _
ppShapeFormatGIF)

But, in my copy of PPT 2003/SP3, the Export method is not supported
for a ShapeRange. The help indicates it is only available for a
Presentation or SlideRange collection, which does not suit my
purposes.

Recording a macro of the use of the Right-click context menu "Save as
Picture ..." process presents this sequence, while correctly saving
the selected picture off of a slide:

ActiveWindow.Selection.SlideRange.Shapes("Picture 6").Select
ActivePresentation.SaveAs FileName:="C:\Picture1.jpg", _
FileFormat:=ppSaveAsJPG, EmbedTrueTypeFonts:=msoFalse

However, when executed as a macro, it saves the whole presentation as
a set of slide images in jpg format in a folder not a file. This is
not acceptable or useable, because the images include the text over
the image.

Has anyone figured out how to *automate* the extraction of a single
image from a slide? I sure hope I don't have to resort to a Sendkeys
solution!

Thanks,

Tom Lavedas
***********
 
T

T Lavedas

Hi TL

ShapeRange.Export is a hidden method

Go to View > Object Browser in the VBE and right click > View Hidden Members

See if that helps

John
--

john ATSIGN PPTAlchemy.co.uk
Custom vba coding and PPT Makeovers
Free PPT Hints, Tips and Tutorialshttp://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html

OK, that was what I needed. I got it working. Thanks a lot.

Please forgive me for looking a gift horse (the PPTFAQ) in the mouth,
but a reference to that fact in the FAQ would have been nice. It had
the correct answer, but my ability to over-analyze the problem kept me
from trying it when the 'Intellisense' failed to include it in its
list of properties/methods for SlideRange. The knowledge that it was
a 'hidden' method would have kept me from going off track. I'll try
to remember that the next time I'm faced with an apparent
contradiction like that.

Thanks again,

Tom Lavedas
***********
 
J

John Wilson

You're welcome Tom

PPTFAQ is the best mind!

John

Hi TL

ShapeRange.Export is a hidden method

Go to View > Object Browser in the VBE and right click > View Hidden
Members

See if that helps

John
--

john ATSIGN PPTAlchemy.co.uk
Custom vba coding and PPT Makeovers
Free PPT Hints, Tips and
Tutorialshttp://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html

OK, that was what I needed. I got it working. Thanks a lot.

Please forgive me for looking a gift horse (the PPTFAQ) in the mouth,
but a reference to that fact in the FAQ would have been nice. It had
the correct answer, but my ability to over-analyze the problem kept me
from trying it when the 'Intellisense' failed to include it in its
list of properties/methods for SlideRange. The knowledge that it was
a 'hidden' method would have kept me from going off track. I'll try
to remember that the next time I'm faced with an apparent
contradiction like that.

Thanks again,

Tom Lavedas
***********
 
T

T Lavedas

Nothing to forgive, Tom.  It'd be harder to let you off the hook if you
DIDN'T report problems with the FAQ.  

And btw, you're absolutely correct.  It was missing crucial information..  
I've fixed the problem.  


And PPT must do the same over-analysis <g>.  It wouldn't have compiled or run
from the IDE until you had it show hidden members.  It'll it'll run on other
PCS though, once compiled into an add-in.

==============================
PPT Frequently Asked Questionshttp://www.pptfaq.com/

PPTools add-ins for PowerPointhttp://www.pptools.com/

Thanks for your reply. And thanks for maintaining such a useful site.

My current need was in implementing a stand-alone HTA that uses the
PPT classes, so it works without the need to adjust of the PPT
environment. Had I just taken you at your word and implemented it, it
would have worked the first time. But, I tried to check it out in PPT
first and when that failed I was in trouble.

Tom Lavedas
***********
 

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