Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 440
Default Format some, not all, text in a comment

Using "Target.Offset(, 1).AddComment", I can add a comment to a cell which
will display values from UserForm 1 TextBox2 and TextBox3.
In between these two values in the comment, I have placed a " v " (to
indicate one party against the other).
I would like to format this "v" to bold and red.
As both TextBox Values are unknown lengths, how can I achieve this?
Many thanks
--
Traa Dy Liooar

Jock
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Format some, not all, text in a comment

Try the below..

Sub Macro1()

Dim objCom As Comment, strText1 As String, strText2 As String

strText1 = "Man"
strText2 = "Animal"

Set objCom = Range("A1").AddComment(strText1 & " v " & strText2)

With objCom.Shape.TextFrame
.Characters(Len(strText1) + 2, 1).Font.ColorIndex = 3
.Characters(Len(strText1) + 2, 1).Font.Bold = True
End With

End Sub

--
Jacob


"Jock" wrote:

Using "Target.Offset(, 1).AddComment", I can add a comment to a cell which
will display values from UserForm 1 TextBox2 and TextBox3.
In between these two values in the comment, I have placed a " v " (to
indicate one party against the other).
I would like to format this "v" to bold and red.
As both TextBox Values are unknown lengths, how can I achieve this?
Many thanks
--
Traa Dy Liooar

Jock

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Format some, not all, text in a comment

Another way is to use Instr()

Dim objCom As Comment, strComment As String
strComment = "Man v Animal"
Set objCom = Target.Offset(, 1).AddComment(strComment)
With objCom.Shape.TextFrame
.Characters(InStr(1, objCom.Text, " v ", vbTextCompare),
3).Font.ColorIndex = 3
.Characters(InStr(1, objCom.Text, " v ", vbTextCompare), 3).Font.Bold = True
End With

--
Jacob


"Jock" wrote:

Using "Target.Offset(, 1).AddComment", I can add a comment to a cell which
will display values from UserForm 1 TextBox2 and TextBox3.
In between these two values in the comment, I have placed a " v " (to
indicate one party against the other).
I would like to format this "v" to bold and red.
As both TextBox Values are unknown lengths, how can I achieve this?
Many thanks
--
Traa Dy Liooar

Jock

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
comment format whiskeyromeo Excel Discussion (Misc queries) 2 February 18th 10 08:00 PM
How can i set preliminary format for comment box? rattwattana Setting up and Configuration of Excel 1 December 11th 08 06:49 PM
Decide comment format 'globally'? Restore format with ws_change? tskogstrom Excel Discussion (Misc queries) 0 April 16th 07 09:07 AM
group comment format on text wildlysa Excel Worksheet Functions 1 January 29th 06 02:14 AM
FORMAT COMMENT TEXT WITH MACRO Sunil Patel Excel Programming 4 June 30th 05 05:13 PM


All times are GMT +1. The time now is 08:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"