Archive for the ‘Uncategorized’ Category

h1

Word: Macro to autofit all tables to the window size

February 17, 2019

Some 11 years ago, I published a macro for setting all tables to autofit to the width of the page (i.e. within the page margins). Here’s a slightly different version written by Stefan Blom in 2012—his original macro was called SetFitToWin, but I’ve modified that for my purposes so I can easily see from the name what this macro does:

Sub SetTableToFitToWindow()
' From Stefan Blom (April 2012):
' https://answers.microsoft.com/en-us/msoffice/forum/all/set-table-to-default-autofit-to-window/a0fffbad-0081-436c-b932-decf404cd88f
' Adapted title (was SetFitToWin), Rhonda Bracey, Cybertext Consulting, Feb 2019

    Dim t As Table
    For Each t In ActiveDocument.Tables
        t.AutoFitBehavior wdAutoFitWindow
    Next t
End Sub

The same caveats apply as per the original blog post in 2008—this changes ALL your tables, so test on a copy of your document first to make sure you don’t inadvertently change tables you didn’t want to change.

[Links last checked February 2019]

h1

Word: Apply a highlight to all tracked changes

November 22, 2018

Over on an editors’ group I’m part of on Facebook, Wendy asked if there was a way to highlight all her tracked changes. Well, tracked changes are already shown in a different font colour and formatted with underlines (insertions) or strikethroughs (deletions) by default, but she wanted more.

As she found, find and replace didn’t work with finding tracked changes. So she was looking for a macro. I’m not good at writing macros, but I’m pretty good at finding them! And then at modifying them for my purposes. A quick search found two possibilities:

I tested them both on an 80p Word document with some 1450 revisions — the first one worked well and quickly (less than 1 minute), but accepted all my track changes and applied a dark green highlight, which I found hard to read. The second was either still going after an hour, or had hung. Whatever, it had stopped Word and I had ‘not responding’ in the title bar. I ‘killed’ Word and decided to only go back to that one if I couldn’t make the modifications I wanted to the first one.

Meantime, I modified the first macro to NOT accept all the track changes and to change the highlight colour to pink instead of the dark green. Here’s my version of that macro in case it ever disappears from the intertubes at that website. Full credit goes to the macro author ‘nixda’.

If you intend using this macro, copy and paste it — some of the lines may go off the page and you’ll miss this information if you type it.

Sub Tracked_to_highlighted()

' Macro provided by nixda, 18 Sep 2014, https://superuser.com/questions/813428/convert-tracked-changes-to-highlighted
' Adapted by Rhonda Bracey, CyberText Consulting Pty Ltd, 22 Nov 2018, 
' to not accept all track changes and change highlight colour to pink
    tempState = ActiveDocument.TrackRevisions

' Turn off track changes
    ActiveDocument.TrackRevisions = False
    For Each Change In ActiveDocument.Revisions
        Set myRange = Change.Range
        ' myRange.Revisions.AcceptAll
        myRange.HighlightColorIndex = wdPink
    Next
    ActiveDocument.TrackRevisions = tempState
End Sub

[Links last checked November 2018]