Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-19-2023, 08:54 AM
VBAadvocate VBAadvocate is offline How to know if TOC changed after update Windows 10 How to know if TOC changed after update Office 2019
Novice
How to know if TOC changed after update
 
Join Date: Feb 2022
Posts: 12
VBAadvocate is on a distinguished road
Default

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
Reply With Quote
 

Tags
compare, toc update

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to know if TOC changed after update 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
How to know if TOC changed after update Update Outlook but user path changed Ossie1972 Outlook 1 12-08-2010 08:19 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:35 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft