Avatar of mtthompsons
mtthompsons
 asked on

How can i reset all images size to default in a word file

How can i reset all images size to default in a word file
I have many word files and all images and reduced from its original size. How can i reset them to the original size in one go?

thanks
Microsoft WordVB ScriptScripting Languages

Avatar of undefined
Last Comment
Rgonzo1971

8/22/2022 - Mon
Rgonzo1971

Hi,

pls try
Sub macro()
For Each shp In ActiveDocument.InlineShapes
    If shp.Type = wdInlineShapePicture Then
        shp.LockAspectRatio = msoFalse
        sclH = shp.ScaleHeight
        SclW = shp.ScaleWidth
        shp.Height = shp.Height * 100 / sclH
        shp.Width = shp.Width * 100 / SclW
    End If
Next
End Sub

Open in new window

Regards
Rgonzo1971

augmented code
Sub macro()
For Each shp In ActiveDocument.InlineShapes
    If shp.Type = wdInlineShapePicture Then
        shp.LockAspectRatio = msoFalse
        sclH = shp.ScaleHeight
        SclW = shp.ScaleWidth
        shp.Height = shp.Height * 100 / sclH
        shp.Width = shp.Width * 100 / SclW
    End If
Next
For Each shp In ActiveDocument.Shapes
    If shp.Type = msoPicture Then
        shp.LockAspectRatio = msoFalse
        shp.ScaleHeight 1, True
        shp.ScaleWidth 1, True
    End If
Next
End Sub

Open in new window

Regards
Wayne Herbert

DO you want the images to still be contained in the Word files or are you looking for full size images only?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
mtthompsons

ASKER
Thanks i get the attached error

Yes images have to be in the file just need to resize them inside the word file
mtthompsons

ASKER
ASKER CERTIFIED SOLUTION
Rgonzo1971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.