PDA

View Full Version : Change color of a text box's outline



hkeiner
11-06-2015, 04:09 PM
I have set up a process for users to insert multiple 'text box' shapes in to Word 2010 documents, enter text in to the newly created text boxes, select the newly entered text in a text box, and then click on one of various available macro buttons on the QAT (linked to my VBA code) to apply specific formats to the selected text (e.g Bold, Font Name, Font Size, style name, etc). I know how to do all this and it works great for custom formatting the text inside the various text boxes used for different purposes.

What I want to ALSO do now is add VBA code to change the text box's outline color at the same time that the text is selected and formatted by the above described macro. How do I do this? I presume I need to add code that does the following:

- Specify the active text box (shape) as the one with the selected text (or cursor) inside it.
- Specify the active text box's outline as being a particular color (e.g., black or red) or make the outline invisible (no outline).

Thanks in advance for any advice

gmaxey
11-06-2015, 05:49 PM
If you have the textbox text selected then something like this:


With Selection.ShapeRange(1)
.Line.Visible = msoTrue
.Line.Weight = 5
.Line.ForeColor = wdColorGreen
End With