Introduction to how to bulk modify the size and scale of pictures in Word

Source: Internet
Author: User

A problem with the recent small compilation is that you need to shrink all of the pictures in a Word document proportionally. It's too much trouble to change a piece. So I scoured the internet and found a solution. Attention should be paid to the conversion between the centimeter and pixel. Under normal circumstances 1 cm =28px. This conversion relationship can actually be calculated with a calculator. The formula calculates the pixel after the picture changes by dividing the size of the picture after the change in centimeters.


Fixed long-width article
This part is about modifying all the pictures in Word to be fixed and the same length and width!


1, open Word, tools-macros-macros (or directly press ALT+F8) into the macro interface, as shown below, enter a macro name, macro name yourself, can remember on the line!





2, Macro name up, click "Create" to enter the Visual Basic Editor, enter the following code and save the


Sub setpicsize () Set picture size


Dim n ' picture number


On Error Resume Next ' Ignore error


Forn = 1 ToActiveDocument.InlineShapes.Count ' inlineshapes type picture


activedocument.inlineshapes (n). Height = 400 ' Set picture height to 400px


activedocument.inlineshapes (n). width = 300 ' Set Picture width 300px


Nextn


Forn = 1 ToActiveDocument.Shapes.Count ' Shapes type picture


activedocument.shapes (n). Height = 400 ' Set picture height to 400px


ActiveDocument.Shapes (n). width = 300 ' Set Picture width 300px


Nextn


End Sub





3, return Word, tools-macros-macros (or directly press Alt+f8), again into the macro interface, select the macro just edited, and click the "Run" button, you can! (The picture may take some time)


Scale the article


This part is to say that all the pictures in Word scale!


specific operation ibid, just a little bit of code to make changes, the code is as follows:


Sub setpicsize () Set picture size


Dim n ' picture number


Dimpicwidth


Dimpicheight


On Error Resume Next ' Ignore error


for n = 1 ToActiveDocument.InlineShapes.Count ' inlineshapes type picture


picheight = Activedocument.inlineshapes (n). Height


picwidth = Activedocument.inlineshapes (n). Width


activedocument.inlineshapes (n). Height = picheight * 1.1 ' Set altitude is 1.1 times times


activedocument.inlineshapes (n). width = picwidth * 1.1 ' setting is 1.1 times times


Nextn


for n = 1 to ActiveDocument.Shapes.Count ' Shapes type picture


picheight = ActiveDocument.Shapes (n). Height


picwidth = ActiveDocument.Shapes (n). Width


activedocument.shapes (n). Height = picheight * 1.1 ' Set altitude is 1.1 times times


activedocument.shapes (n). width = picwidth * 1.1 ' setting is 1.1 times times


Nextn


End Sub





if you want to align all the pictures in the center, add the following statement to the loop:


activedocument.inlineshapes (n). Range.paragraphformat.alignment= wdAlignParagraphCenter





' left-aligned: wdAlignParagraphLeft





Note: The Shapes (inlineshapes) Here are not just pictures, but also other AutoShapes, freeform shapes, OLE objects, ActiveX controls, pictures, and so on.

Note : Please pay attention to the Office software tutorial section, triple Computer office group: 189034526 welcome you to join

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.