Paste Special>Picture?

J

JethroUK©

Anyone know what 'type' of picture file this method produces? - I need to
reproduce this command in V.Basic. (it doesn't work in recorded macro)
 
J

Jean-Guy Marcil

JethroUK© was telling us:
JethroUK© nous racontait que :
Anyone know what 'type' of picture file this method produces? - I
need to reproduce this command in V.Basic. (it doesn't work in
recorded macro)

Have you looked at the PasteSpecial method in the VBA help?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

JethroUK©

it specifies other picture types (jpegs, bitmaps,etc) - but not which type
of picture as defined by pastespecial/'picture' - i think it's metafile
 
J

Jean-Guy Marcil

JethroUK© was telling us:
JethroUK© nous racontait que :
it specifies other picture types (jpegs, bitmaps,etc) - but not which
type of picture as defined by pastespecial/'picture' - i think it's
metafile

The definition is:

PasteSpecial(IconIndex, Link, Placement, DisplayAsIcon, DataType,
IconFileName, IconLabel)
The datatype is the one you want.

The problem is that the available DataTypes depend on the clipboard content.
If the clipboard contains a picture, you can use "15" as DataType to paste a
JPEG format. But if the clipboard contains text, this DataType will generate
an error. The metafile format (wdPasteMetafilePicture or "3") always works,
I think, regardless of the clipboard content. So if you cannot control what
a user has put in the clipboard, then use that DataType. Otherwise, you have
to check the clipboard content, then, based on the content, use a different
DataType. If you need to go that way, let us know, code to test the
Clipboard content can be posted. But first, ask yourself if you really need
to specify the picture type in Word....

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

JethroUK©

You've confirmed my suspicions - i read the type of the picture i wanted,
and it was '3' - which from your findings = wdPasteMetafilePicture

many thanks
 
J

JethroUK©

The problem i have is really simple but i'm not finding it easy to solve -
by default m.s. Word by retains cropped areas of pictures so you can
un-crop them again - this can lead to picture documents of a staggering 30
meg - word has always had a built-in compression method for dealing with
this:

Format>Pictures>Compress>All Pictures>OK

which simply removes the cropped area perminently - problem is, this picture
compression doesn't work in Word XP , never has done

the none-coding work around is simply to cut the picture & pastespecial as
'picture' - voila - this disposes of any cropped areas (compresses the
picture) - super

i need to code this process for large documents i am developing daily, but
when i record the same process by macro, the code it produces does not do
the same thing at all - it merely pastes back the UN-cropped picture -
grrrrrrrr

i beginning to feel that the best method would be to re-install word 2000 or
word 97 - the code i have so far:

Sub CompressPictures()

Dim s As InlineShape

For Each s In ActiveDocument.InlineShapes
s.Select
Selection.Cut
Selection.PasteSpecial DataType:=wdInlineShapePicture
Next

End Sub
 
J

Jean-Guy Marcil

JethroUK© was telling us:
JethroUK© nous racontait que :
The problem i have is really simple but i'm not finding it easy to
solve - by default m.s. Word by retains cropped areas of pictures
so you can un-crop them again - this can lead to picture documents of
a staggering 30 meg - word has always had a built-in compression
method for dealing with this:

Format>Pictures>Compress>All Pictures>OK

which simply removes the cropped area perminently - problem is, this
picture compression doesn't work in Word XP , never has done

the none-coding work around is simply to cut the picture &
pastespecial as 'picture' - voila - this disposes of any cropped
areas (compresses the picture) - super

i need to code this process for large documents i am developing
daily, but when i record the same process by macro, the code it
produces does not do the same thing at all - it merely pastes back
the UN-cropped picture - grrrrrrrr

i beginning to feel that the best method would be to re-install word
2000 or word 97 - the code i have so far:

Sub CompressPictures()

Dim s As InlineShape

For Each s In ActiveDocument.InlineShapes
s.Select
Selection.Cut
Selection.PasteSpecial DataType:=wdInlineShapePicture
Next

End Sub

OK, so if you know you are dealing with pictures, have you tried with "15"
as DataType? This pastes a JPEG and cuts out cropped areas.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

JethroUK©

Jean-Guy Marcil said:
JethroUK© was telling us:
JethroUK© nous racontait que :


OK, so if you know you are dealing with pictures, have you tried with "15"
as DataType? This pastes a JPEG and cuts out cropped areas.


i've tried jpegs and a lot of quality is lost in print (m.s help suggests
the default 'picture' type is the optimum (and it certainly is), alas it
doesn't say what type it is :eek:) - i haven't had time to check it out yet but
i'm sure picture type 3 (wdPasteMetafilePicture
you found) will do the trick - thanks very much
 

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