Reading picture types in vba

J

JethroUK©

i have written some code to convert picture files to metafile:

Sub CompressPictures()

Dim x%

With ActiveDocument.InlineShapes
For x% = 1 To .Count
.Item(x%).Select
Selection.Cut
Selection.PasteSpecial , , wdInLine, , wdPasteMetafilePicture
Next
End With

End Sub

i add pictures (screenshots) to the document regularly and would prefer only
to covert the new pics (bitmaps i think) - but i dont know how to read the
picture type before writing it - any ideas?

InlineShapes.Type ?????
 
J

JethroUK©

the only person that can decide whether it's answered (by definition) is
me - and it isn't!

anyone got any clues?
 
D

Doug Robbins - Word MVP

Well, it would help if you did not post the same question separately to
multiple newsgroups so that everything is kept in the thread. If you
believe that it is appropriate to post to more than one group, put the
newsgroup names in the header of the one message.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

JethroUK©

i 'had' a seperate post that didn't bear fruit - hence the new, wider,
x-post (now realise i should've done in the first instance)

regarding the subject - anyone got any clues?
 
J

Jezebel

You've already had the answer. It's a pity it's not the one you want; but
asking the same question repeatedly in the hope of a new response is not
going to cure your cancer.
 
M

macropod

Hi Jethro,

You could give each converted shape a unique bookmark, then you'd only need
to look for shapes that lack one.

Alternatively, you could paste the converted ones as Shapes (i.e. floating)
instead of inline, then you'd only need to look for shapes that are still
inline.

Cheers
 
J

JethroUK©

i gave that a try - but unsuccessfully - i cant float the shapes because
that changes the whole document - tried bookmarking but to do that i still
have to 'select' all the shapes first & it took even longer

it did give an idea however - i might just add a border to the shapes as
they're converted and i think i can check for the border without select the
shape

thanks for input
 
M

macropod

Hi Jethro,

Changing the shapes from inline to floating doesn't have to change your
document layout - all you have to do is to format the floating shape in a
way that replicates its inline behaviour.

Cheers
 
J

John Nurick

Hi Macropod,
format the floating shape in a
way that replicates its inline behaviour.

Is that actually possible, and if so how? I can - just - imagine writing
code to convert an inline shape to a floating shape with the shape and
the paragraph it's anchored to formatted so as to maintain its previous
position on the page.

But I'm boggling at the thought of formatting a floating shape so it
moves from page to page exactly as an inline shape would when the
surrounding text changes, let alone one that couldn't be nudged out of
alignment by careless mousing.
 
M

macropod

Hi John,

By setting the floating shape's positioning relative to the paragraph it's
anchored to, via:
..RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
you can make it move with the text.

Of course, there's no preventing the careless user from re-positioning the
shape, but you can at least keep its anchor locked to the intended
paragraph, with:
..LockAnchor = True

Cheers
macropod
[Microsoft Word MVP]
 

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