AlexanderBB
Well-known Member
- Joined
- Jul 1, 2009
- Messages
- 1,835
- Office Version
- 2019
- 2016
- Platform
- Windows
Hi,
I reverse engineered a function that sets the text color in the first line of a comment.
I'm now trying to read that color back and failing.
I call this from the immediate window as
? GetCommentLineOneColor("Sheet1", "J116") where there's a comment in J116.
I'm getting Run-time error '438':
Object doesn't support this property or method
on the Debug.Print line.
Any help sorting this appreciated. Thanks
I reverse engineered a function that sets the text color in the first line of a comment.
I'm now trying to read that color back and failing.
Code:
Function GetCommentLineOneColor(ksheet, kAddr) As Variant
Dim r As Range, l As Integer
Set r = Worksheets(ksheet).Range(kAddr)
With r
If Not .Comment Is Nothing Then
l = InStr(.Comment.text, vbLf)
With .Comment
With .Shape
Debug.Print .Characters(1, l).Font.Color
End With
End With
End If
End With
End Function
I call this from the immediate window as
? GetCommentLineOneColor("Sheet1", "J116") where there's a comment in J116.
I'm getting Run-time error '438':
Object doesn't support this property or method
on the Debug.Print line.
Any help sorting this appreciated. Thanks