#1
|
|||
|
|||
How to know if TOC changed after update
I would like to know if my TOC changed after I update it with the following:
ActiveDocument.TablesOfContents(1).Update Perhaps something like saving a copy of the range before updating and compare the saved range with the range after the update. Is there an easy and simple way to do this? |
#2
|
|||
|
|||
Easier than I thought. I think this works but maybe there will be a catch, somehow.
Code:
Sub CheckIfTOC_Changed() Dim rng As Range Dim strBefore As String Dim strAfter As String Set rng = ActiveDocument.TablesOfContents(1).Range strBefore = rng.Text ActiveDocument.TablesOfContents(1).Update Set rng = ActiveDocument.TablesOfContents(1).Range strAfter = rng.Text If strBefore = strAfter Then MsgBox "No change" Else MsgBox "Changed" End If End Sub |
Tags |
compare, toc update |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Update all fields won't update index! | Ryhne | Word VBA | 4 | 04-23-2020 04:49 AM |
Unit is $, should be € - why is it being changed? | Officer_Bierschnitt | PowerPoint | 2 | 01-14-2016 03:04 AM |
Formatting has changed? | Colonel Biggs | Word | 3 | 03-13-2015 09:14 PM |
Update a summary chart when I update a dashboard with dates | cangelis | Excel | 6 | 09-24-2014 08:08 AM |
Update Outlook but user path changed | Ossie1972 | Outlook | 1 | 12-08-2010 08:19 PM |