Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 01-16-2013, 12:12 PM
fumei fumei is offline Range.Collapse? Windows 7 64bit Range.Collapse? Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

Oooops, sorry. That is what I get having multiple forums open at the same time. I was responding to something else. My bad.

However, to answer the question, the Collapse itself does not really do anything...welll not technically true. It DOES collapse the range, but that itself has no real effect. Or rather, there is an effect but it makes no difference.

During a Find operation, the actual range object is changed to each Found. This is happening. It then moves on to the next Found.

You use a Collapse instruction when you CHANGE something in the Found. Say you find "cat", and you change the "c" to an "h". Because there is a change (and it more noticeable in a format rather than textual change), the Find operation starts up again at the START of the last Found (i.e "hat"). In this case, the Find will ignore "hat" (because the Find text is "cat"). It moves on searching for the next "cat".

But suppose you had a Bold operation to the found - that is "cat" remains "cat", but bolded. In that case, when the change to the range is done, Find starts up again at the START of the last Found - i.e the SAME "cat" found. In which case the code keeps on finding the same instance of "cat".

Thus the need for a Collapse. The "cat" is found, the bold is applied, the range is collapsed to the END of the found range, and starts again...thus going on to the NEXT "cat".

You use a Collapse when there is a change to the found range.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Expand/Collapse default settings not retained PatP Outlook 8 07-25-2013 11:44 PM
Expand/Collapse in Html Word File kitkat0910 Word 0 10-10-2012 03:42 AM
multiple text boxes collapse on move apricoti Word 2 01-26-2012 05:55 PM
Range.Collapse? Drop-Down Menu, show-hide, expand-collapse??? 300zxmuro Word 1 02-27-2011 03:02 PM
Range.Collapse? Expand & Collapse Folders in "Unread Mail" WoodstockCEO Outlook 3 02-14-2010 09:11 PM

Other Forums: Access Forums

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