Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-21-2024, 03:38 AM
RRB's Avatar
RRB RRB is offline Macro to navigate to next CR from present location Windows 11 Macro to navigate to next CR from present location Office 2021
Susan Flamingo
Macro to navigate to next CR from present location
 
Join Date: May 2014
Location: The Holy City of Jerusalem
Posts: 297
RRB is on a distinguished road
Default Macro to navigate to next CR from present location

I have Googled and found nothing. ChatGPT offered me this:




Sub JumpToNextCrossReference()
Dim rng As Range
Dim fld As Field

' Define the range to search for cross-references
Set rng = Selection.Range

' Loop through each field in the document
For Each fld In ActiveDocument.Fields
If fld.Type = wdFieldRef Then
' Check if the field is within the defined range
If fld.Result.InRange(rng) Then
' Select the field and exit the loop
fld.Select
Exit For
End If
End If
Next fld
End Sub

But it is not working and I cannot understand why.

SF
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Command Buttons to Navigate thru Word SnakeDoctor Word VBA 2 07-06-2023 07:47 AM
Macro to navigate to specific point in line (Word 97) Genericname1111 Word 13 10-06-2019 08:54 PM
Can't navigate to entries in table of contents treez Word 4 12-25-2018 08:37 AM
Macro to navigate to next CR from present location Macro: How to get this macro to save to a specific location LOUF Word VBA 1 12-07-2015 06:47 PM
Macro Location eliz.bell Word 0 10-05-2009 07:44 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:13 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