Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-06-2022, 10:57 AM
m2ramos m2ramos is offline Selection.Information not working as intended for selection position Windows 10 Selection.Information not working as intended for selection position Office 2016
Novice
Selection.Information not working as intended for selection position
 
Join Date: Nov 2022
Posts: 2
m2ramos is on a distinguished road
Default


Quote:
Originally Posted by gmaxey View Post
Finding text with a range object doesn't select the text so your selection is where it is throughout the process:

Code:
Dim oRng As Range
Sub getPosition()
    Debug.Print oRng.Information(wdVerticalPositionRelativeToPage)
    Debug.Print oRng.Information(wdHorizontalPositionRelativeToPage)
End Sub

Sub Test()
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Text = "Test Words"
    While .Execute
      getPosition
      oRng.Collapse wdCollapseEnd
    Wend
  End With
End Sub
Thanks for the update. With the information about select that you provided, I managed to get my code working by adding rngSearch.Select within the Do While Loop. That got me what I needed. Thank you.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Selection.Information not working as intended for selection position VBA help With Selection.Range not working Shelley Lou Word VBA 1 12-23-2021 06:24 AM
Selection.Information not working as intended for selection position change header, footer information dependent on selection in drop down list dogbural Word VBA 2 06-07-2020 04:12 PM
Working with selection.tables PRA007 Word VBA 3 02-25-2016 01:49 AM
Selection.Information not working as intended for selection position Working with Selection.range. PRA007 Word VBA 2 02-19-2016 12:52 AM
Selection.Information not working as intended for selection position Selection of all Text for a specific page in word is spanning selection across pages ramsgarla Word VBA 9 12-05-2012 03:23 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:19 AM.


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