I just up?graded to MS Office for Mac and Excel 2019 for Mac. I'm trying to duplicate macros I had in Excel 2011 in Excel 2019.
I'm finding there are many changes to VBA between 2011 and 2019..
My problem is with comments. I'm trying to set the text in the comment attached to the current cell to size 12, font bold to false, size to 200x75.
This is only for the currently selected cell, not across the whole spreadsheet.
Here's the code from Excel 2011,
Option explicit
Sub FormatComment()
'Format text
With Selection.Comment.Shape.TextFrame
.Characters.Font.Size = 12
.Characters.Font.Bold = False
End With
'Set size
With Selection.Comment
.Shape.Width = 200
.Shape.Height = 75
End With
Selection.Comment.Visible = True
End Sub
This runs fine in VBA 2011, in VBA 2019 it chokes on "With Selection.Comment.Shape.TextFrame"
Run-Time Error '1004':
Application-Defined or Object-Defined Error
I've googled the dickens out of this and have not found a solution.
So- how do you format a comment in VBA 2019
I'm finding there are many changes to VBA between 2011 and 2019..
My problem is with comments. I'm trying to set the text in the comment attached to the current cell to size 12, font bold to false, size to 200x75.
This is only for the currently selected cell, not across the whole spreadsheet.
Here's the code from Excel 2011,
Option explicit
Sub FormatComment()
'Format text
With Selection.Comment.Shape.TextFrame
.Characters.Font.Size = 12
.Characters.Font.Bold = False
End With
'Set size
With Selection.Comment
.Shape.Width = 200
.Shape.Height = 75
End With
Selection.Comment.Visible = True
End Sub
This runs fine in VBA 2011, in VBA 2019 it chokes on "With Selection.Comment.Shape.TextFrame"
Run-Time Error '1004':
Application-Defined or Object-Defined Error
I've googled the dickens out of this and have not found a solution.
So- how do you format a comment in VBA 2019