Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Feb 2002
    Location
    CT, USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Extracting pics and clipart from PPT files (vb)

    Hi,

    I am running up against an issue, and I was wondering if you have encountered it. Or could direct me to where I could get information on it (I have already left messages on the UT, compuserve, foxforum, and a few other places).

    Rather than creating powerpoint content, I am trying to parse it. I have no trouble extracting the text and formatting.

    In a sense, what I am trying to do is to break powerpoint presentations down into internet content. The problem that I am running into is that I want to be able to extract the embedded pictures and clipart. Slides seem to have all the methods in the world for adding pictures and clipart INTO content, but for the life of me I cant figure out how to get it out.

    I have looked at the "SaveAs" method, but that only saves each entire slide as a picture.

    Another thought I had is that maybe if I do a Shape.Copy() of the shape containing a picture, and then I could somehow get it and save it. But I'm stuck at that point.

    Any thoughts? Ideas?

    Thanks!
    Rick Hodder

  2. #2
    New Lounger
    Join Date
    Feb 2002
    Location
    CT, USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extracting pics and clipart from PPT files (vb)

    OK,

    I've got a solution that's workable.

    In Powerpoint 2000, if you save a presentation as a web page, it generates the following (assuming I said save it as a web page called test.htm):

    1. An HTM file called *pagename*.htm (test.htm) that is a "viewer" of the presentation
    2. A directory called *pagename*_files - in my example "test_files"
    3. The directory contains HTM files representing each page in the presentation
    4. The directory contains image files, all named for the page that the slide is on: ex. if there is an image on page 2 and it was a jpg, there is a file called slide0002_image001.jpg.
    5. There's even several XML files that drive the presentation, one of which is filelist.xml, which surprisingly (g) contains a list of the files in the presentation.

    So although a bit messy (export a lot, just to get the pictures), it will get the job done.

    Anyone who figures out an easier way - please let me know,

    Thanks,
    Rick

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Extracting pics and clipart from PPT files (vb)

    Rich,

    I did a little experiment. I've never use VBA with powerpoint before. But it wasn't too bad.

    I inserted 2 clip-art pictures, drew 1 rectangle and created a text box on 1 slide.

    I then recorded a macro of me using the tab key to go from object to object (did you know you could do that?) and clicking to select (which I probably didn't need to do since the action of tabbing selects the next item). Here's what the macro recorder gave me:

    <pre>Sub Macro1()
    ActiveWindow.Selection.SlideRange.Shapes("Object 4").Select
    ActiveWindow.Selection.SlideRange.Shapes("Rectangl e 5").Select
    ActiveWindow.Selection.SlideRange.Shapes("Text Box 6").Select
    ActiveWindow.Selection.SlideRange.Shapes("Object 3").Select
    End Sub
    </pre>


    The Object Items are the clipart, in case you couldn't tell. Don't ask why the numbers in the names are like they are - they do seem to follow the order I inserted things in but don't know where 1 and 2 are (maybe were used for the slide?).

    Based on my VBA knowledge (for excel and access), I also added a loop as follows inside the macro:
    <pre> Dim sh As Shape
    For Each sh In ActiveWindow.Selection.SlideRange.Shapes
    MsgBox sh.Type & "-" & sh.Name
    Next
    </pre>


    The Type gave me a number that, I guess, maps to the shape type (sh.Type) and the items name (sh.Name) as given in the first code segment. In this way, one can do a test to determine if the object is a type you want to work further with. If it is, you can probably do something like sh.select. It would probably not be too hard to save the item inside the loop.

    Your HTML approach is not too bad either.

    Good Luck

    Fred

  4. #4
    New Lounger
    Join Date
    Feb 2002
    Location
    CT, USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Extracting pics and clipart from PPT files (vb)

    Hi Fred,

    Thanks for responding. Basically I had gotten to the same point you did (although I am using VFP instead of VBA) - the problem I'm encountering is that there is no "save" to call <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>

    The HTML approach is the only way I've seen so far.

    A funny thing about the HTML approach too - if you drop a picture onto a page and save it to HTML you get one image associated with the page: e.g. slide00001_image0001.jpg. If you drop a picture onto a page, and adjust the size of the image on the slide, and save it to HTML you get two images associated with the page: e.g. slide00001_image0001.jpg and slide00001_image0002.jpg. slide00001_image0002.jpg is used from one of the generated HTM pages, but slide00001_image0001.jpg is not. slide00001_image0001.jpg appears to be the image in its original form (dimensions, filesize, etc).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •