Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-25-2014, 12:53 PM
marqives marqives is offline Changing the font colour in all text boxes Windows 8 Changing the font colour in all text boxes Office 2013
Novice
Changing the font colour in all text boxes
 
Join Date: Nov 2014
Posts: 1
marqives is on a distinguished road
Default Changing the font colour in all text boxes

Hi All,
I have a document with lots of text boxes.
Can anyone suggest a VBA method of changing the font colour in all of them at the same time.
I'm trying to learn VBA and this seems like a good place to start.


This is my first post here so please be kind to a newbie.
regards marqives
Reply With Quote
  #2  
Old 11-25-2014, 06:05 PM
macropod's Avatar
macropod macropod is offline Changing the font colour in all text boxes Windows 7 64bit Changing the font colour in all text boxes Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Ideally, you'd start by defining an appropriate Paragraph Style or Character Style for the textbox content. You'd then apply that Style to all the textboxes. From then on, if you want to change any of the font attributes in the textboxes, all you'd need to do is to update the Style definition. No code required.

The programming problem at this stage, then, becomes one of applying your Style. For that you could use code like:
Code:
Sub Demo()
Dim Shp As Shape
For Each Shp In ActiveDocument.Shapes
  With Shp
    If .Type = msoTextBox Then
      .TextFrame.TextRange.Style = "MyStyle"
    End If
  End With
Next
End Sub
where 'MyStyle' is your Style's name.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
font change colour, textboxes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing the font colour in all text boxes Changing the placeholder text for drop down boxes DeadBatteries Word 1 08-24-2012 09:09 AM
Changing the font colour in all text boxes Arrows and text boxes disappear when changing view? Jesse Word 4 06-12-2012 05:28 PM
Changing the font colour in all text boxes Font colour and format changing? Lamya Word 5 05-16-2011 02:35 AM
changing the colour of text box highlight in PowerPoint v.x miki PowerPoint 1 11-16-2010 02:06 AM
Bug in PPT 2007 - Font and line spacing in text boxes Amateur PowerPoint 0 09-01-2010 03:34 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:56 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft