ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Comment Font Name trouble (https://www.excelbanter.com/excel-programming/372136-comment-font-name-trouble.html)

Albert

Comment Font Name trouble
 
Hi... I´m modifying all the comments in a worksheet with the following code.
Everything works fine except the Courier New Font. The font simply does not
change. Give me a hand?
Thanks in advance,
Albert

Dim MyComments As Comment
Dim lArea As Long
For Each MyComments In ActiveSheet.Comments
With MyComments
.Shape.TextFrame.AutoSize = True
.Shape.TextFrame.Characters.Font.Name = "Courier New"
If .Shape.Width 300 Then
lArea = .Shape.Width * .Shape.Height
.Shape.Width = 200
' An adjustment factor of 1.1 seems to work ok.
.Shape.Height = (lArea / 200) * 1.1
End If
End With
Next ' comment

JLGWhiz

Comment Font Name trouble
 
This might do it:

If .Type = msoTextEffect Then
.TextEffect.FontName = "Courier New"
End If


"Albert" wrote:

Hi... I´m modifying all the comments in a worksheet with the following code.
Everything works fine except the Courier New Font. The font simply does not
change. Give me a hand?
Thanks in advance,
Albert

Dim MyComments As Comment
Dim lArea As Long
For Each MyComments In ActiveSheet.Comments
With MyComments
.Shape.TextFrame.AutoSize = True
.Shape.TextFrame.Characters.Font.Name = "Courier New"
If .Shape.Width 300 Then
lArea = .Shape.Width * .Shape.Height
.Shape.Width = 200
' An adjustment factor of 1.1 seems to work ok.
.Shape.Height = (lArea / 200) * 1.1
End If
End With
Next ' comment


Albert

Comment Font Name trouble
 
Sorry, where should I put that?

"JLGWhiz" wrote:

This might do it:

If .Type = msoTextEffect Then
.TextEffect.FontName = "Courier New"
End If


"Albert" wrote:

Hi... I´m modifying all the comments in a worksheet with the following code.
Everything works fine except the Courier New Font. The font simply does not
change. Give me a hand?
Thanks in advance,
Albert

Dim MyComments As Comment
Dim lArea As Long
For Each MyComments In ActiveSheet.Comments
With MyComments
.Shape.TextFrame.AutoSize = True
.Shape.TextFrame.Characters.Font.Name = "Courier New"
If .Shape.Width 300 Then
lArea = .Shape.Width * .Shape.Height
.Shape.Width = 200
' An adjustment factor of 1.1 seems to work ok.
.Shape.Height = (lArea / 200) * 1.1
End If
End With
Next ' comment



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

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