Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 11-06-2022, 10:38 AM
gmaxey gmaxey is offline Selection.Information not working as intended for selection position Windows 10 Selection.Information not working as intended for selection position Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

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
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



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:32 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