Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-09-2018, 03:35 AM
BLUEPUPIL BLUEPUPIL is offline Text box- text color Windows 7 64bit Text box- text color Office 2016
Novice
Text box- text color
 
Join Date: Feb 2016
Posts: 20
BLUEPUPIL is on a distinguished road
Default Text box- text color

I've got a macro, which inserts a text box with a symbol(text) in it. The color of the symbol is Black-(R,G,B)-0,0,0. I want to make it Red-(R,G,B)- 255,0,0. There are two options to achieve this. First by altering the color from black to red and second by changing the initial color. The main difficulty for me is to recognize which part of the macro script deals with the symbol(text) color. Do you have any suggеstions?
Code:
Sub InsertTB()
Dim Shp As Shape
Set Shp = ActiveDocument.Shapes.AddTextbox(1, fcnXCoord, fcnYCoord, 288, 72)
With Shp
.TextFrame.TextRange.InsertSymbol Font:="+Body", CharacterNumber:=9679, Unicode:=True
.Line.Visible = msoFalse
.Fill.Visible = msoFalse
.Width = 155#
.Height = 62#
End With
Set Shp = Nothing
End Sub
Function fcnXCoord() As Double
fcnXCoord = Selection.Information(wdHorizontalPositionRelativeToPage)
End Function
Function fcnYCoord() As Double
fcnYCoord = Selection.Information(wdVerticalPositionRelativeToPage)
End Function

Reply With Quote
  #2  
Old 04-09-2018, 04:47 AM
gmayor's Avatar
gmayor gmayor is offline Text box- text color Windows 10 Text box- text color Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,105
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

It's a characteristic of the font in the text range e.g.
Code:
With .TextFrame.TextRange
            .InsertSymbol Font:="+Body", CharacterNumber:=9679, Unicode:=True
            .Font.ColorIndex = wdRed
End With
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 04-11-2018, 04:09 AM
BLUEPUPIL BLUEPUPIL is offline Text box- text color Windows 7 64bit Text box- text color Office 2016
Novice
Text box- text color
 
Join Date: Feb 2016
Posts: 20
BLUEPUPIL is on a distinguished road
Default

[IMG][/IMG]
Reply With Quote
  #4  
Old 04-11-2018, 04:41 AM
eduzs eduzs is offline Text box- text color Windows 10 Text box- text color Office 2010 32bit
Expert
 
Join Date: May 2017
Posts: 262
eduzs is on a distinguished road
Default

Code:
With Shp
      With .TextFrame.TextRange
            .InsertSymbol Font:="+Body", CharacterNumber:=9679, Unicode:=True
            .Font.ColorIndex = wdRed
      End With
 .Line.Visible=msofalse
.
.
.
__________________
Backup your original file before doing any modification.
Reply With Quote
  #5  
Old 04-11-2018, 05:05 AM
gmayor's Avatar
gmayor gmayor is offline Text box- text color Windows 10 Text box- text color Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,105
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You didn't copy what I posted, so no wonder it doesn't work. Font is an attribute of the text range not of the shape.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #6  
Old 04-11-2018, 06:53 AM
BLUEPUPIL BLUEPUPIL is offline Text box- text color Windows 7 64bit Text box- text color Office 2016
Novice
Text box- text color
 
Join Date: Feb 2016
Posts: 20
BLUEPUPIL is on a distinguished road
Default

[IMG][/IMG] [IMG][/IMG]
Reply With Quote
  #7  
Old 04-11-2018, 03:03 PM
macropod's Avatar
macropod macropod is offline Text box- text color Windows 7 64bit Text box- text color Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

You still haven't implemented the code as advised...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 04-13-2018, 02:38 AM
BLUEPUPIL BLUEPUPIL is offline Text box- text color Windows 7 64bit Text box- text color Office 2016
Novice
Text box- text color
 
Join Date: Feb 2016
Posts: 20
BLUEPUPIL is on a distinguished road
Default

[IMG][/IMG]
Reply With Quote
  #9  
Old 04-13-2018, 03:05 AM
BLUEPUPIL BLUEPUPIL is offline Text box- text color Windows 7 64bit Text box- text color Office 2016
Novice
Text box- text color
 
Join Date: Feb 2016
Posts: 20
BLUEPUPIL is on a distinguished road
Default

On the first place my gratitude goes to gmayor for supplementing the script, then to eduzs for digging into details and finally to macropod for his confirmation that I'm on a wrong track. *** I decided to take my chances and first changed the CharacterNumber from 9679(symbol=dot) to 9632 (symbol=square) then highlighted the symbol with a yellow color. To my great surprise it worked. However, it is hard to believe that, this time I've made things right at the first attempt. I need your final approval of the edited script.

Last edited by BLUEPUPIL; 04-14-2018 at 02:02 AM.
Reply With Quote
  #10  
Old 04-13-2018, 03:51 AM
BLUEPUPIL BLUEPUPIL is offline Text box- text color Windows 7 64bit Text box- text color Office 2016
Novice
Text box- text color
 
Join Date: Feb 2016
Posts: 20
BLUEPUPIL is on a distinguished road
Default

[IMG][/IMG]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced Font Color Manipulation In Word: Inserting another color than the surrounding text stuartg Word 1 02-20-2017 12:38 AM
Text box- text color Text Field [content control] - Default text color vs Filled Text color jackcoletti Word 3 02-01-2017 08:10 AM
VBA Word - Find Text Font Color - Insert New Text jc491 Word VBA 2 01-04-2016 05:42 PM
Text box- text color Remove white text background (keeping the font color and page color intact cc3125 Word 1 10-26-2015 06:44 PM
Text box- text color Macro to search warning text style and replace the text color rohanrohith Word VBA 3 11-27-2014 01:08 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:34 PM.


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