word 2003 code not supporting 2000

A

anand

Hello Group following code ia a word macro, converts all EMF/Pictures of a
word document into Images.
, well thecode is working fine with 2003 , not with 2000, Is it the problem
of library versioning as 2000 uses microsoft object library 9.0 while 2003
uses 11.0. Surprisingly it works when we debug with Key F8.Looking for some
work around . any help would be saluted.

Thanks
Anand
-----------------------------
sub Convert()

Dim MyPix As Shape
Dim PastedPix As Shape
Dim MyRange As Range
Dim PixWrap As Long
Dim PixWrapSide As Long
Dim PixTop As Long
Dim PixLeft As Long

Set MyRange = Selection.Range

For Each MyPix In ActiveDocument.Range.ShapeRange

If MyPix.Type = msoPicture Then

With MyPix
With .WrapFormat
PixWrap = .Type
PixWrapSide = .Side
End With
PixTop = .Top
PixLeft = .Left
.Select
End With

Selection.Cut

Selection.PasteSpecial Link:=False, DataType:=13, Placement:= _
wdFloatOverText, DisplayAsIcon:=False
Set PastedPix = Selection.ShapeRange(1)
With PastedPix
With .WrapFormat
.Type = wdWrapTight
.Side = PixWrapSide
.AllowOverlap = msoFalse
End With

.LockAnchor = msoFalse
.RelativeVerticalPosition = wdRelativeVerticalPositionPage
.Top = InchesToPoints(1.75)
.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
.Left = PixLeft
.Top = PixTop
End With

Set PastedPix = Nothing

End If
Next MyPix

MyRange.Select

Set MyRange = Nothing

end sub
 
C

Cindy M -WordMVP-

Hi Anand,
Group following code ia a word macro, converts all EMF/Pictures of a
word document into Images.
, well thecode is working fine with 2003 , not with 2000, Is it the problem
of library versioning as 2000 uses microsoft object library 9.0 while 2003
uses 11.0. Surprisingly it works when we debug with Key F8.Looking for some
work around . any help would be saluted.
1. macro questions belong in one of the word.vba groups

2. If you're getting an error message, you should post the exact message, as
well as indicate on which line it is occurring. It's impossible for us to do
any trouble-shooting without this information.

3. When writing code that should work in more than one version of an
application, you should develop the code in the earliest version of that
application.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
A

anand

Hello Cindy the Error message is "Run time error '4198 command failed' " And
i am getting it at the line "selection.Pastespecial.........".
Any work around would be highly appriciated...

Thanks for responding

Anand
 
J

Jonathan West

If it is working when you step though pressing F8, then there is an internal
synchronisation problem within Word. These things happen occasionally.

Put 3 or 4 DoEvents commands in the lines immediately preceding the
PasteSpecial, and then try again. The DoEvents commands release the
processor for a moment, allowing Windows to poll the message queue & process
any tasks waiting there. Probably those tasks include internal things within
Word.
 
Top