Re: Picture object retrieval in a word table

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Leigh Webber (lwebber_at_knowhowZZZ.com)
Date: 03/11/04


Date: Wed, 10 Mar 2004 19:55:08 -0600

I can help with some of it. Here's some code you could extend:
----------------------------------
Sub ShowPictureInCell(aoTable As Word.Table, aiRow As Integer, aiColumn As
Integer)
    Dim loShape As Word.Shape
    Dim loInlineShape As Word.InlineShape

    For Each loShape In ActiveDocument.Shapes
        With loShape.Anchor
            If .Information(wdEndOfRangeColumnNumber) = aiColumn _
                And .Information(wdEndOfRangeRowNumber) = aiRow Then
                Debug.Print loShape.Type 'msoShapeType
                Debug.Print loShape.Height
            End If
        End With
    Next loShape

    For Each loInlineShape In ActiveDocument.InlineShapes
        With loInlineShape.Range
            If .Information(wdEndOfRangeColumnNumber) = aiColumn _
                And .Information(wdEndOfRangeRowNumber) = aiRow Then
                Debug.Print loInlineShape.Type 'msoShapeType
                Debug.Print loInlineShape.Height
            End If
        End With
    Next loInlineShape

End Sub

Sub test()
    ShowPictureInCell ActiveDocument.Tables(1), 2, 1
    ShowPictureInCell ActiveDocument.Tables(1), 2, 2
End Sub

---------------------------------------------

The problem is that plain pictures are stored in binary form inside the
document, and Word doesn't expose much info about their native format,
resolution, etc. If they are linked or embedded OLE objects, you would have
more luck. Copying and pasting a graphic into Word, however, inserts the
binary data into the doc, and not a reference to the file name or other info
about where the graphic data came from. You can play around with this code,
trying various types of inserted graphics, and see what you can squeeze out.

HTH

"Ruby Tuesday" <rubytuzdayz@yahoo.com> wrote in message
news:c2nald$1v68tf$1@ID-205437.news.uni-berlin.de...
> How do you retrieve the bitmap information(programatically using VBA or
VBS)
> of any picture object in a cell of a word table - their type(jpg,
bmp,tiff,
> or any known image type), their dimension(width, height), and their pixel
> values?
>
> I'd like to send this image to Access database as a blob for later
> retrieval. Thanks
>
>



Relevant Pages

  • Re: Picture object retrieval in a word table
    ... Sub ShowPictureInCell(aoTable As Word.Table, aiRow As Integer, aiColumn As ... Dim loShape As Word.Shape ... trying various types of inserted graphics, and see what you can squeeze out. ... > or any known image type), their dimension, and their pixel ...
    (microsoft.public.word.vba.general)
  • Re: Picture object retrieval in a word table
    ... Sub ShowPictureInCell(aoTable As Word.Table, aiRow As Integer, aiColumn As ... Dim loShape As Word.Shape ... trying various types of inserted graphics, and see what you can squeeze out. ... > or any known image type), their dimension, and their pixel ...
    (microsoft.public.word.vba.general)
  • Re: Picture object retrieval in a word table
    ... Sub ShowPictureInCell(aoTable As Word.Table, aiRow As Integer, aiColumn As ... Dim loShape As Word.Shape ... trying various types of inserted graphics, and see what you can squeeze out. ... > or any known image type), their dimension, and their pixel ...
    (microsoft.public.word.tables)
  • Re: Picture object retrieval in a word table
    ... Sub ShowPictureInCell(aoTable As Word.Table, aiRow As Integer, aiColumn As ... Dim loShape As Word.Shape ... trying various types of inserted graphics, and see what you can squeeze out. ... > or any known image type), their dimension, and their pixel ...
    (microsoft.public.word.vba.beginners)
  • Re: Picture object retrieval in a word table
    ... Sub ShowPictureInCell(aoTable As Word.Table, aiRow As Integer, aiColumn As ... Dim loShape As Word.Shape ... trying various types of inserted graphics, and see what you can squeeze out. ... > or any known image type), their dimension, and their pixel ...
    (microsoft.public.word.vba.beginners)