I would like to remove selection from code because that usually means it is more efficient and robust.
So there is a code that works fine but selection cannot be removed in the way I expected.
This code changes the color of a form button:
thisworkbook.Sheets("sheet 1").shapes.Range.(Array("Button 3")).Select
With Selection.Font
.color = 10
End with
But the selection cannot be removed this way:
thisworkbook.Sheets("sheet 1").shapes.Range.(Array("Button 3")).Font.color = 10
It drops runtime error: 438 – Object doesn’t support this property or method.
How can we remove selection?
Update and Solution:
thisworkbook.Sheets("sheet 1").shapes.Range.("Button 3").TextFrame.Characters.Font.color = 10
So Array() is dropped from ShapeRange, and TextFrame.Characters. is added to the reference.
house_of_codes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
thisworkbook.Sheets("sheet 1").shapes.Range.("Button 3").TextFrame.Characters.Font.color = 10
So Array() is dropped from ShapeRange, and TextFrame.Characters. is added to the reference.
house_of_codes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.