Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Text color to black in textboxes with VBA in word 2010

Status
Not open for further replies.

bazwillrun

Instructor
Jun 26, 2011
1
GB
Just wondering if anybody can help me out please

I have a script that removes color/ picture fills from text boxes and it changes text to black.
Problem is it doesnt change text thats in the text boxes, only text thats on the page
I have looked all over the web and tried various things but so far no luck.
anybody here able to help please

Here is the script I am using:
---------------------------------------------------------------

Sub colourclear()

' colourclear Macro
ActiveDocument.Range.Font.ColorIndex = wdBlack
Dim oShape As Shape
For Each oShape In ActiveDocument.Shapes
Debug.Print oShape.Name
If oShape.Type = msoTextBox Then
oShape.Fill.Visible = msoFalse
oShape.Line.Visible = msoFalse
End If
Next oShape

End Sub
 
Largely because you don't have a line that attempts to change the color of the text inside a text box.

Try

Code:
oShape.TextFrame.TextRange.Font.Color = wdColorBlack

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top