PDA

View Full Version : PictureWrapType equivalent in Word 2000?



khagerman
03-04-2005, 06:33 PM
Hiya,

I am using some VBA code to set the picturewraptype in some Word documents that are created from a template. The template was developed in Word 2003.

I have a friend who has performed some testing for me using both Word 2002 and Word 2000. Works fine in Word 2002, errors out in Word 2000 with a compile error.

I see now that picturewraptype was new in Word 2002 VBA. What I'm trying to insure is that pictures will be inserted in line with the text instead of floating. Anyone know what the equivalent VBA would be in Word 2000?

Anne Troy
03-25-2005, 07:13 AM
Did you ever get an answer for this? I'd love to have your code. Specifically, select graphic, run macro, and the pic is formatted to in line with text.

I've got 97 through 2003 here, and happy to test. :)

hairywhiterabbit
03-27-2005, 05:02 PM
Hi khagerman and Dreamboat,

I've had this problem in Word 2000. I was copying pictures out of Adobe Illustrator and pasting them into Word.

I had to paste them as an enhanced metafile (which comes in as floating), convert them to an 'inline shape' and then cut and paste again to get it in the correct spot!! Good to see they've fixed in Word 2002 on.

Anyway, hope this code helps you guys. It was originally written from Excel, so you may be able to condense some of the .selection lines.

sub PasteClip(sBkMarkName as String, iHeight as Integer, iWidth as Integer)
ActiveDocument.Bookmarks(sBkMarkName).Range.Select
Selection.PasteSpecial Link:=False, DataType:=wdPasteEnhancedMetafile, DisplayAsIcon:=False

'Need to resize to a consistant height and lock the aspect ratio
Selection.ShapeRange.LockAspectRatio = msoTrue
If iHeight <> 0 Then Selection.ShapeRange.Height = iHeight
If iWidth <> 0 Then Selection.ShapeRange.Width = iWidth

'Convert the shape to an inline shape
Selection.ShapeRange.ConvertToInlineShape

'Because the floating location moves when converted into an inline shape
'we need to cut and paste to align it with the bookmark
Selection.MoveRight wdCharacter, 1, wdExtend
Selection.Cut
ActiveDocument.Bookmarks(sBkMarkName).Range.Select
Selection.Paste
end sub

Cheers,
Andrew

Anne Troy
03-27-2005, 05:12 PM
Andrew: Before you paste as an enhanced metafile (or whatever), place your cursor where you want the graphic to be. Then you don't have to cut/paste again to move it.

hairywhiterabbit
03-27-2005, 05:52 PM
Hi Dreamboat,

Unfortunately, Word 2000 seems to paste the picture as a floating shape. When you convert it to an inline shape it moves in the document (I don't know if this is fixed in newer versions of word). Then you have to cut and paste it again to the correct spot. As far as I can see you can't paste it as an inline shape.

Cheers,
Andrew

Anne Troy
03-27-2005, 06:00 PM
"fixed"?? Heck no. I PREFER having it inline. Then I can treat it like a line of text, and use formatting on it, like space before and after, and even apply a style to it. No, you can't paste inline.

hairywhiterabbit
03-27-2005, 06:09 PM
I agree, I don't think I have every used a floating picutre type and can't see any reasons where it would be preferable.