ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FORMAT COMMENT TEXT WITH MACRO (https://www.excelbanter.com/excel-programming/333297-format-comment-text-macro.html)

Sunil Patel

FORMAT COMMENT TEXT WITH MACRO
 
i need to enter as a comment two words with the "Enter key" press between
the words. This i can do
But i want to format the text in the comment box. i.e top word in Arial 14
bold in blue and the bottom word in Arial 14 bold in pink.
is this possible - Code would be a great help if possible

Sunil



Tom Ogilvy

FORMAT COMMENT TEXT WITH MACRO
 
Turn on the macro recorder and do it manually. Should give you what you
need.

--
Regards,
Tom Ogilvy


"Sunil Patel" wrote in message
...
i need to enter as a comment two words with the "Enter key" press between
the words. This i can do
But i want to format the text in the comment box. i.e top word in Arial 14
bold in blue and the bottom word in Arial 14 bold in pink.
is this possible - Code would be a great help if possible

Sunil





Tom Ogilvy

FORMAT COMMENT TEXT WITH MACRO
 
Pantel informed me it didn't record and he is correct.

Sub AddCustomComment()
On Error Resume Next
ActiveCell.Comment.Delete
On Error GoTo 0
Set cmt = ActiveCell.AddComment( _
Text:="ABCD" & Chr(10) & "EFHG")
With cmt.Shape.TextFrame.Characters(1, 4)
.Font.Name = "Arial"
.Font.Bold = True
.Font.ColorIndex = 5
End With
With cmt.Shape.TextFrame.Characters(6, 4)
.Font.Name = "Arial"
.Font.Bold = True
.Font.ColorIndex = 7
End With
End Sub


--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Turn on the macro recorder and do it manually. Should give you what you
need.

--
Regards,
Tom Ogilvy


"Sunil Patel" wrote in message
...
i need to enter as a comment two words with the "Enter key" press

between
the words. This i can do
But i want to format the text in the comment box. i.e top word in Arial

14
bold in blue and the bottom word in Arial 14 bold in pink.
is this possible - Code would be a great help if possible

Sunil







Tom Ogilvy

FORMAT COMMENT TEXT WITH MACRO
 
Right you a

Sub AddCustomComment()
On Error Resume Next
ActiveCell.Comment.Delete
On Error GoTo 0
Set cmt = ActiveCell.AddComment( _
Text:="ABCD" & Chr(10) & "EFHG")
With cmt.Shape.TextFrame.Characters(1, 4)
.Font.Name = "Arial"
.Font.Bold = True
.Font.ColorIndex = 5
End With
With cmt.Shape.TextFrame.Characters(6, 4)
.Font.Name = "Arial"
.Font.Bold = True
.Font.ColorIndex = 7
End With
End Sub

Your interpretation of pink may be different from mine, so adjust the last
colorIndex value from 7 to your definition.

Adjust the numbers in Characters to reflect the length of the words you add
in the comment.

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Turn on the macro recorder and do it manually. Should give you what you
need.

--
Regards,
Tom Ogilvy


"Sunil Patel" wrote in message
...
i need to enter as a comment two words with the "Enter key" press

between
the words. This i can do
But i want to format the text in the comment box. i.e top word in Arial

14
bold in blue and the bottom word in Arial 14 bold in pink.
is this possible - Code would be a great help if possible

Sunil







Tom Ogilvy

FORMAT COMMENT TEXT WITH MACRO
 
Left out the size 14

Sub AddCustomComment()
On Error Resume Next
ActiveCell.Comment.Delete
On Error GoTo 0
Set cmt = ActiveCell.AddComment( _
Text:="ABCD" & Chr(10) & "EFHG")
With cmt.Shape.TextFrame.Characters(1, 4)
.Font.Name = "Arial"
.Font.Size = 14
.Font.Bold = True
.Font.ColorIndex = 5
End With
With cmt.Shape.TextFrame.Characters(6, 4)
.Font.Name = "Arial"
.Font.Size = 14
.Font.Bold = True
.Font.ColorIndex = 7
End With
End Sub

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Right you a

Sub AddCustomComment()
On Error Resume Next
ActiveCell.Comment.Delete
On Error GoTo 0
Set cmt = ActiveCell.AddComment( _
Text:="ABCD" & Chr(10) & "EFHG")
With cmt.Shape.TextFrame.Characters(1, 4)
.Font.Name = "Arial"
.Font.Bold = True
.Font.ColorIndex = 5
End With
With cmt.Shape.TextFrame.Characters(6, 4)
.Font.Name = "Arial"
.Font.Bold = True
.Font.ColorIndex = 7
End With
End Sub

Your interpretation of pink may be different from mine, so adjust the last
colorIndex value from 7 to your definition.

Adjust the numbers in Characters to reflect the length of the words you

add
in the comment.

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Turn on the macro recorder and do it manually. Should give you what you
need.

--
Regards,
Tom Ogilvy


"Sunil Patel" wrote in message
...
i need to enter as a comment two words with the "Enter key" press

between
the words. This i can do
But i want to format the text in the comment box. i.e top word in

Arial
14
bold in blue and the bottom word in Arial 14 bold in pink.
is this possible - Code would be a great help if possible

Sunil










All times are GMT +1. The time now is 06:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com