P
Piou2fois
Hi all
I was looking for a script able to decrease the word file size with a
lot of pictures.
I found the possibility to use cut and pastespecial as jpg
here is the script i use :
Function cut_paste_as_jpg(image As InlineShape) As Boolean
image.Select
question = (MsgBox("Do you want toconvert this picture?",
vbYesNoCancel, "Convert to jpg"))
Select Case question
Case vbYes
Selection.CopyAsPicture
Selection.PasteSpecial Link:=False, _
DataType:=15, _
Placement:=wdInLine
cut_paste_as_jpg = True
Case vbNo
cut_paste_as_jpg = True
Exit Function
Case vbCancel
cut_paste_as_jpg = False
End Select
End Function
Sub jpg_mass_convert()
Dim image As InlineShape
For Each image In ActiveDocument.InlineShapes
If Not cut_paste_as_jpg(image) Then Exit Sub
Next image
End Sub
This script is great for all inlineshape and you can win size
Big problem is that with this method, each picture has 2 problems
-a 1px black border below and right of the picture
-paste as something which is not inlineshape (picture is in edit mode)
do you think there is something to do avoid these two problems, because
for the first point it is horrible to see that, and for the second one,
I cannot put border on the picture with macro.
Thank you in advance for your attention
Regards
Guillaume MASSART (FRANCE)
I was looking for a script able to decrease the word file size with a
lot of pictures.
I found the possibility to use cut and pastespecial as jpg
here is the script i use :
Function cut_paste_as_jpg(image As InlineShape) As Boolean
image.Select
question = (MsgBox("Do you want toconvert this picture?",
vbYesNoCancel, "Convert to jpg"))
Select Case question
Case vbYes
Selection.CopyAsPicture
Selection.PasteSpecial Link:=False, _
DataType:=15, _
Placement:=wdInLine
cut_paste_as_jpg = True
Case vbNo
cut_paste_as_jpg = True
Exit Function
Case vbCancel
cut_paste_as_jpg = False
End Select
End Function
Sub jpg_mass_convert()
Dim image As InlineShape
For Each image In ActiveDocument.InlineShapes
If Not cut_paste_as_jpg(image) Then Exit Sub
Next image
End Sub
This script is great for all inlineshape and you can win size
Big problem is that with this method, each picture has 2 problems
-a 1px black border below and right of the picture
-paste as something which is not inlineshape (picture is in edit mode)
do you think there is something to do avoid these two problems, because
for the first point it is horrible to see that, and for the second one,
I cannot put border on the picture with macro.
Thank you in advance for your attention
Regards
Guillaume MASSART (FRANCE)