![microsoft word align middle microsoft word align middle](https://support.content.office.net/en-us/media/16d4f055-7940-4da2-aa51-bb2483959651.png)
#Microsoft word align middle code#
That’s what these two lines of code are for: Set objShape = objDoc.ShapesĪs you doubtless know, CD, by default Word left-aligns any pictures you insert programmatically. To do that we create an instance of the document’s Shapes collection, then use the AddPicture method to insert the picture C:\Scripts\Welder-small.jpg.
![microsoft word align middle microsoft word align middle](https://www.digitalunite.com/sites/default/files/images/LZ0029-3-rightalign.jpg)
Our next step is to insert a picture into the document. We then use this line of code to create a new document we can work with: Set objDoc = () We’ll use these two constants to center the picture (wdShapeCenter) and then to configure the picture word wrap (wdWrapSquare).Īfter defining the constants we create an instance of the Word.Application object and set the Visible property to True that gives us a running instance of Microsoft Word that we can see on screen. As you can see, we start out by defining a pair of constants, wdShapeCenter (and yes, -999995 is the real value we need to assign to the constant) and wdWrapSquare. No promises here, but we’ll try to explain this script the best we can. ObjShape.AddPicture(“C:\Scripts\Welder-small.jpg”) Set objWord = CreateObject(“Word.Application”) (According to the old cliché “like it rolled off a table.”) Because these pitches are well-nigh impossible to hit, the so-called “spitball” has been illegal for decades.Īnd yes, up until 1920 the spitball was legal in fact, Scripting Guy Peter Costantini used to throw the spitter as a boy in New Jersey.Īt any rate, CD, here’s a perfectly natural, perfectly legal script that center-aligns a picture in Microsoft Word: Const wdShapeCenter = -999995 Why do major league umpires throw out any baseball that has so much as a blemish on it? Because major league pitchers can take a baseball that has a scuff mark, a dab of Vaseline, or a little pine tar on it and then throw a pitch that is essentially unhittable: typically the ball will come in straight and then, swiftly and unexpectedly, dive straight into the ground. If you’re not a fan of America’s national pastime we should make it clear that the sport has very strict rules against “doctoring” baseballs. OK, true, there are cookie crumbs wedged between some of the keys on the keyboard.
#Microsoft word align middle series#
In light of the controversy surrounding World Series game 2 (was Detroit Tigers pitcher Kenny Rogers throwing “goopballs” or wasn’t he?) the Scripting Guys felt it was important to note that no illegal substances were used in the writing of today’s Hey, Scripting Guy! column: no pine tar, no Vaseline, not even any peanut butter. Hey, Scripting Guy! How can I center-align a picture in a Word document?