Romulus
04-23-2010, 04:56 AM
Hello all,
I need your help, for you this is for sure a walk in a park, but for me it is not :banghead: . I have got a Word 2000 file, a report in which I insert various pictures. Document is quite long (up to 60 pages) and number of pictures is also significant, up to 40 pictures. To avoid having a huge file in the end (~ 30 MB), I need to edit each picture, taking following steps:
A). Select the picture, CTRL + X;
B). Paste Special – Picture;
C). Select the picture, CTRL + X, Paste Special, Picture (JPEG);
D). Picture cropping on right hand side (5.25 units) + picture cropping on bottom side (2.65 units);
E). Select the picture, then Text Wrapping, Top and bottom;
F). Save the document.
I have tried to solve it, by recording a macro, the issue is that it stops after step B. I guess it stops because right after step B picture is not anymore selected, therefore the routine stops.
Here is the code I have got:
Sub JPEGs()
'
' JPEGs Macro
Selection.Cut
Selection.PasteSpecial Link:=False, DataType:=wdPasteMetafilePicture, _
Placement:=wdFloatOverText, DisplayAsIcon:=False
Selection.Cut
Selection.PasteSpecial Link:=False, DataType:=15, Placement:= _
wdFloatOverText, DisplayAsIcon:=False
Selection.ShapeRange.PictureFormat.CropRight = 5.25
Selection.ShapeRange.PictureFormat.CropBottom = 2.65
Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom
ActiveDocument.Save
End Sub
When I run it, it just stops on second “Selection.Cut” (marked in red), error generated is: Run-time error ‘4605’. This method or property is not available because the object is empty.
Could you please help me to make it work ?
Or, is there any other solution, to avoid having huge Word 2000 files, after inserting many, many pictures ?
Please note that I do not want this macro to apply these steps/editing to all pictures intersted into the file, I just want it to apply the changes to the picture I select, nothing else. Thank you in advance and have a nice day.
Romulus.
I need your help, for you this is for sure a walk in a park, but for me it is not :banghead: . I have got a Word 2000 file, a report in which I insert various pictures. Document is quite long (up to 60 pages) and number of pictures is also significant, up to 40 pictures. To avoid having a huge file in the end (~ 30 MB), I need to edit each picture, taking following steps:
A). Select the picture, CTRL + X;
B). Paste Special – Picture;
C). Select the picture, CTRL + X, Paste Special, Picture (JPEG);
D). Picture cropping on right hand side (5.25 units) + picture cropping on bottom side (2.65 units);
E). Select the picture, then Text Wrapping, Top and bottom;
F). Save the document.
I have tried to solve it, by recording a macro, the issue is that it stops after step B. I guess it stops because right after step B picture is not anymore selected, therefore the routine stops.
Here is the code I have got:
Sub JPEGs()
'
' JPEGs Macro
Selection.Cut
Selection.PasteSpecial Link:=False, DataType:=wdPasteMetafilePicture, _
Placement:=wdFloatOverText, DisplayAsIcon:=False
Selection.Cut
Selection.PasteSpecial Link:=False, DataType:=15, Placement:= _
wdFloatOverText, DisplayAsIcon:=False
Selection.ShapeRange.PictureFormat.CropRight = 5.25
Selection.ShapeRange.PictureFormat.CropBottom = 2.65
Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom
ActiveDocument.Save
End Sub
When I run it, it just stops on second “Selection.Cut” (marked in red), error generated is: Run-time error ‘4605’. This method or property is not available because the object is empty.
Could you please help me to make it work ?
Or, is there any other solution, to avoid having huge Word 2000 files, after inserting many, many pictures ?
Please note that I do not want this macro to apply these steps/editing to all pictures intersted into the file, I just want it to apply the changes to the picture I select, nothing else. Thank you in advance and have a nice day.
Romulus.