I want to change the attributes of the text inside in Cell's Comment object. The automatically generated macro that Excel produced does not work. When running that macro I get the error "Object doesn't support this property or method". I fixed this by changing ".ShapeRange" to ".Shape". Next the error "Object doesn't support this action" was produce by "TextFrame2". I am providing the following 2 procedures of code. The first is the original the second is my attempt to solve the problem. However my code is generating the error "Method 'TextFrame' of object 'Shape' failed".
Sub OriginalMacro()
Range("H25").Select
Selection.ShapeRange.ScaleWidth 3.3647051779, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 1.3800319525, msoFalse, msoScaleFromTopLeft
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(2, 322).Font
.NameComplexScript = "Times New Roman"
.NameFarEast = "Times New Roman"
.Name = "Times New Roman"
End With
Selection.ShapeRange(1).TextFrame2.TextRange.Characters(2, 322).Font.Size = 12
Selection.ShapeRange(1).TextFrame2.TextRange.Characters(2, 322).Font.Bold = _
msoTrue
Range("H25").Comment.Text Text:= _
"Simply place positive numbers in any of the cells from G26 thru G43 directly above the cell that displays the total amount just to the right of the word ""Total;"". They will be added together and dispa"
Range("H25").Comment.Text Text:= _
"yed in the cell next to the word ""Total:"". " & Chr(10) & "" & Chr(10) & "If you want to subtract a number simply place a negative sign in front of it." & Chr(10) & "" _
, Start:=200
Selection.ShapeRange.ScaleHeight 1.1283545656, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleWidth 1.0731088187, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleWidth 1.0473934127, msoFalse, msoScaleFromTopLeft
Range("E32").Select
End Sub
Sub FormatCalcComment()
Range("H25").Select
Range("H25").Comment.Visible = True
Range("H25").Comment.Shape.ScaleWidth 3.605455577, msoFalse, msoScaleFromTopLeft
Range("H25").Comment.Shape.ScaleHeight 1.3080804104, msoFalse, msoScaleFromTopLeft
'Range("H25").Comment.Select
Range("H25").Comment.Shape.Select
'*********The following line generates the error.**********
Range("H25").Comment.Shape.TextFrame.Characters(1, 323).Font.Name = "Times New Roman"
With Range("H25").Comment.Shape.TextFrame.Characters(1, 323).Font
.NameComplexScript = "Times New Roman"
.NameFarEast = "Times New Roman"
.Name = "Times New Roman"
End With
Range("H25").Comment.Shape.TextFrame2.TextRange.Characters(1, 323).Font.Size = 12
Range("H25").Comment.Shape.TextFrame2.TextRange.Characters(1, 323).Font.Bold = _
msoTrue
Range("H25").Comment.Text Text:= _
"Simply place positive numbers in any of the cells from G26 thru G43 directly above the cell that displays the total amount just to the right of the word ""Total;"". They will be added together and displ"
Range("H25").Comment.Text Text:= _
"ayed in the cell next to the word ""Total:"". " & Chr(10) & "" & Chr(10) & "If you want to subtract a number simply place a negative sign in front of it." & Chr(10) & "" _
, Start:=200
Range("H25").Comment.Shape.ScaleWidth 1.055297049, msoFalse, msoScaleFromTopLeft
Range("H25").Comment.Shape.ScaleHeight 1.2445311296, msoFalse, msoScaleFromTopLeft
Range("H26").Select
End Sub
Should be Bold faced and changed to New Times Roman. And the frame resized to fit.