MyRange.Collapse Direction:=wdCollapseStartįor more information about using the Range Object, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type Range Object in the Office Assistant or the Answer Wizard, and then click Search to view the topic.įor more information about using the Selection Object, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type Selection Object in the Office Assistant or the Answer Wizard, and then click Search to view the topic. This example inserts text placed on the clipboard at the current position of the insertion point. Anchor lock takes a few clicks to get to, natively, but this macro is handy if you use shapes/objects a lot - add it to your toolbar/ribbon to toggle locks on & off: Sub ToggleShapeAnchor () If Selection.Type wdSelectionShape Then For Each Shape In Selection.ShapeRange Shape.LockAnchor Not Shape. Using the Range or Selection object to paste from the clipboard I want to highlight an image in the document, then click a Quick Access Toolbar button and have it put a border of 1.5 and text wrap, 'tight'. ' Range Example: Inserts text at the beginning This method is applied, the range or selection expands to include the new Inserts the specified text at the beginning of a range or selection.
#MACRO TO ADD BORDER TO TEXT BOX IN WORD SERIES#
Select the box then go to Shape Format Insert Shapes Edit Shapes Change. I am trying to use VBA to create a series of text boxes in a Word document automatically and then set the style of them.
#MACRO TO ADD BORDER TO TEXT BOX IN WORD HOW TO#
It’s the same text box with all the power that text boxes offer, just with a different shaped border. How to Insert a Text Box in MS Word - To add text in box right click on box, here one dialog box will apear now you can click on add text to add text in box. ' (Inserts text at the current position of the insertion point.) But once it’s inserted, a Word text box can be transformed many different shapes including Rounded Corners.
The circle is now beginning to look a bit silly: Perhaps our choices werent so good after all. You could extend the macro above to change the border colour and style of the shape: now make the border purple and dotted. Inserts the specified text at the end of a range or selection. An example of formatting a shapes border. Using Range or Selection object with the InsertAfter/InsertBefore method InsertAfter method example: