rescuing comments section from the 80's trap

msword

Board Regular
Joined
Oct 23, 2020
Messages
54
Office Version
  1. 2019
Platform
  1. Windows
  2. MacOS
Hi. I work with comments everyday and disability to
1. set default font/size
2. non-changable positioning outside the viewport
ruins everything. I am even thinking to switch to another piece of software just because of this. After some googling I discovered that comments section code base not changed since 80's, thus fix of the mentioned bugs are not expected in the next 5-10 years. As a guy that never wrote a line of code, I wonder is there any chance to fix this using VBA or something?
I tried to run this code:
VBA Code:
Sub FormatAllComments()
'Updateby20140509
Dim xWs As Worksheet
Dim xComment As Comment
For Each xWs In Application.ActiveWorkbook.Worksheets
 For Each xComment In xWs.Comments
 With xComment.Shape.TextFrame.Characters.Font
 .Name = "Times New Roman"
 .Size = 33
 End With
 Next
Next
End Sub
but getting the error message:
photo_2024-09-04_07-43-18.jpg


I suppose that mentiong that I am sitting on the macos version of Excel is also important.
Thanks.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi there,

Based on Damon's solution from this thread the following should do the job:

VBA Code:
Option Explicit
Sub Macro2()

    Dim rngcell As Range
    Dim xWs As Worksheet
    
    Application.ScreenUpdating = False
    
    For Each xWs In ThisWorkbook.Worksheets
        For Each rngcell In xWs.UsedRange
            If Not rngcell.Comment Is Nothing Then
                With rngcell.Comment.Shape.TextFrame.Characters.Font
                    .Size = 33
                    .Name = "Times New Roman"
                End With
            End If
        Next rngcell
    Next xWs
    
    Application.ScreenUpdating = False

End Sub

comments section code base not changed since 80's

Considering VBA was first released for Excel in 1993 I'm not sure about this 🤔

Regards,

Robert
 
Upvote 0
Same error as shown on the screenshot beyond. Do I paste it in the right direction(Tools > Macro > Visual Basic Editor > This Workbook > RMC > Insert > Module > "Run Sub/UserForm" button)?
 
Upvote 0
Yes that's right and then you'd run Macro2 whenever you need.

Strange as it works for me? Is the tab protected?
 
Upvote 0

Forum statistics

Threads
1,224,798
Messages
6,181,038
Members
453,014
Latest member
Chris258

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top