Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-12-2020, 10:27 PM
mdlewis mdlewis is offline VBA Find a string and move the cursor to it Windows 7 64bit VBA Find a string and move the cursor to it Office 2010
Novice
VBA Find a string and move the cursor to it
 
Join Date: Jan 2019
Posts: 8
mdlewis is on a distinguished road
Default VBA Find a string and move the cursor to it

I have a document which has a string such as <<INTERESTS>> in it. To humans this is a placeholder but to word it is just a string.



I want to find each occurrence of <<INTERESTS>>, MOVE the cursor there and then paste material from another doc.

If I use the various methods of find and replace, the string changes but the cursor stays where it was last, and the inserts all occur there.

I want to find "<<INTERESTS>>", move the cursor there and insert / paste THERE.

I don't want to add bookmarks to each occurrence of <<INTERESTS>> unless no other method of positioning succeeds.

Michael
Reply With Quote
  #2  
Old 02-12-2020, 11:00 PM
macropod's Avatar
macropod macropod is offline VBA Find a string and move the cursor to it Windows 7 64bit VBA Find a string and move the cursor to it Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Does what you want to paste in each location differ? If not, the simplest way of updating all instances is, in fact, to bookmark the first, then use cross-references to that bookmark for all the others. Otherwise, you need to tell us what determines the replacement content for each instance.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-13-2020, 02:36 AM
mdlewis mdlewis is offline VBA Find a string and move the cursor to it Windows 7 64bit VBA Find a string and move the cursor to it Office 2010
Novice
VBA Find a string and move the cursor to it
 
Join Date: Jan 2019
Posts: 8
mdlewis is on a distinguished road
Default

Thanks, the pasting is no problem.

I want to find a text placemaker "<<INTERESTS>>" which may occur more than once in the main document. The emphasis is on find, because I want the cursor to move to the "found" <<INTERESTS>>, at which physical place, I will paste in the relevant document. I know that I can place bookmarks at each placeholder, but I want to use an existing document for preference.

The various find examples I've tried, find the string, but do not move the cursor to it.

Michael
Reply With Quote
  #4  
Old 02-13-2020, 03:53 AM
macropod's Avatar
macropod macropod is offline VBA Find a string and move the cursor to it Windows 7 64bit VBA Find a string and move the cursor to it Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

There is no need to move the cursor when pasting programmatically, which is why I asked about what it is you're pasting - which you haven't answered.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Find a string and move the cursor to it A macro to find a symbol, delete it, and move the cursor to that location JayBird24 Word VBA 1 08-19-2016 04:26 PM
How to find all string within string. PRA007 Word VBA 18 02-12-2016 08:11 PM
VBA Find a string and move the cursor to it move cursor anand Word VBA 14 07-07-2015 05:57 AM
VBA Find a string and move the cursor to it Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM
can't move the cursor in Word pieboy Word 2 02-13-2009 07:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:51 AM.


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