Today I was documenting the installation of a new BizTalk environment. The document is an overview from A to Z, which describes how to install and configure this particular BizTalk environment. Typically, as one might expect, this type of documentation contains a lot of screenshots/images.
My method was the following:
- Create a screenshot using Lightshot. It’s a great (and FREE) application which can take screenshots of anything open on your screen, with the added benefit to save to a file immediately, upload to to Imgur, make notes on it, etc…
- Copy the screenshot to the clipboard
- Paste it into Word (2016)
- Right-click the image and select “Size and Position“
- Reset the image to 50% of it’s height, while having the aspect ration locked
- Clicking OK
Obviously, it involves quite a lot of clicks and is pretty time consuming and pretty tedious… considering the fact I have about 50-100 images to put into the document, I wanted it to become better. The client I was sitting next to, insisted there was a way with Word macros, but didn’t know quite how to do it.
Creating the Macro
10 minutes of Googling and some trial and error, and low-and-behold, this is the button which is now up on my Home toolbar:
As with many things, it’s actually quite easy to get it for yourself:
- Enable the Developer toolbar in Word. Right click any button or space in your toolbar and click “Customize the Ribbon“.
- Check the checkbox for the Developer Tab and click OK.
- Click the Developer toolbar and click “Macros”
- Type the name (e.g. “ResizePictureto50Percent”) and click the “Create” Button.
- You should now get the following screen:
- Copy/Paste the macro (you can find the code below this list), as below, and close the screen:
- Again, customize the toolbar by right clicking any space or button in the toolbar and select “Customize the Ribbon“. Select Macros and insert your new macro as a button into the place you want it to have:
You now have a fully functional button (which you can customize to your liking)!
The macro code you need:
Sub ResizePictureto50Percent() With Selection If .InlineShapes.Count > 0 Then With .InlineShapes(1) .Height = .Height / 2 End With Exit Sub Else With .ShapeRange .Height = .Height / 2 End With End If End With End Sub
Testing the Macro
Now, when I copy/paste an image or screenshot in Word, I have the following screen:
After I select the image (just click it once), click the button, I now get the following:
It even continues to shrink when I keep clicking it, as it will reduce to half its size every time I do this.
Great stuff and saves me a lot of clicks!