
- #How to reduce size of document to insert into word how to#
- #How to reduce size of document to insert into word full#
- #How to reduce size of document to insert into word code#
Check ALL images in your document to see if any changed that you didn’t want to change (look for such things as logos, cover page art elements, images in landscape orientation that are now much narrower than you wanted, etc.). Run the resizeImages macro on a COPY of your document. If you have images in your document that SHOULDN’T be resized, then either consider not using this macro at all, or using it for everything, then manually sizing those few images back to their original dimensions. #How to reduce size of document to insert into word code#
Under the Normal > Modules folder in Project Explorer, add this code to NewMacros:Īs I mentioned at the beginning of this post, you’ll need to test this macro to see if it suits your purposes.
The aspect ratio of the image is kept when the macro resizes the width, it keeps the proportions for the height. I’m not sure what the multiplication factor of 28.34 means, but I suspect it’s something to do with converting the underlying measurement units (twips? points?) in Word to centimetres. InsertedShape.Height = insertedShape.Height * imgMult / insertedShape.Width InsertedPictureHeight = insertedPictureHeight * imgMult / insertedPicture.Widthįor Each insertedShape In ActiveDocument.Shapes Spin Control code:ĭouble-click the spin control and add this line between the Sub and End Sub lines: TextBox1.Value = SpinButton1.Value / 10ĭouble-click the Exit button and add this line between the Sub and End Sub lines: Unload meĭouble-click the Resize Images button and add these lines between the Sub and End Sub lines - make sure you use the exact case and punctuation as listed here (Note: Some lines shown below will wrap in WordPress - check the screen shot to see where the lines break I’ve left these lines in as text so you can copy/paste them):įor Each insertedPicture In ActiveDocument.InlineShapes Now that you have your form, you can add the code that sits behind the various elements. explanatory text at the top, ‘cm’ label to the right of the text box and spin control to the right of that, command buttons at the bottom of the form etc.).
Arrange all elements on the form to follow familiar GUI principles (e.g. Open the properties for UserForm1 and change the Caption to Resize all images.
Open the properties for CommandButton2 and change the Caption text to Exit.Open the properties for CommandButton1 and change the Caption text to Resize Images.Open the properties of the other label and change the Caption text to cm (for centimetres).Open the properties of one of the labels, delete the text in the Caption field and add some explanatory text there - see the screen shot below for my example.If you only want your users to use the spin control to set the value and don’t want to let them change it in the text box, set the Locked property to True. Open the properties of the text box and set the Value to 5 (this means the default displayed in the text box will be 5 cm change it to suit your circumstances).if you have a 2-column document and only want small widths for the images, set the Max to 75 or similar). Adjust these values to suit your circumstances (e.g.
#How to reduce size of document to insert into word how to#
Open the properties of the spin control and set these values: Max: 160 (this will allow a maximum width of 16 cm sorry - I don’t know how to set this for inches) Min: 20 (minimum width of 2 cm) Small change: 5 (increments of 0.5 cm) Value: 50. Add these elements to the form - TWO command buttons, ONE spin button, TWO labels, and ONE text box. Select Insert > UserForm from the menu. Test the macro on a COPY of an existing document. Create a form that any user can complete when they run the macro that lets them specify the width (in centimetres) they want for all images and inline shapes. As with any such global change, test it on a COPY of your original document before using it on your original. This may NOT be what you want and you may decide that this macro isn’t for you.
This post will not take you step-by-step through that process.īEWARE! This macro WILL resize ALL images in your Word document to the same width - that includes any cover art, logos, images on landscape pages, etc. You should be familiar with writing macros using the VBA code editor in Word.
#How to reduce size of document to insert into word full#
Full credit and kudos should go to Helen and APC for this information - I only tweaked it and expanded upon it to suit my purposes, and added full steps and screen shots.
This post is an adaptation of an article by Helen Bradley in Australian Personal Computer magazine (January 2014 issue, p99).