View Single Post
 
Old 01-18-2023, 04:23 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Using Bookmarks is quite clumsy because you have little control on where those bookmarks start/end and the 'end' may be in front of the 'start'. Once you have removed the intervening content you will find it difficult to prise the two locations apart again.

A simpler way of defining a location for content is to use a Content Control and write to that.
Code:
ActiveDocument.SelectContentControlsByTitle("Info")(1).Range.Text = "Hi Mum"
Note that when you remove all content of that CC, it will display the placeholder text which may or may not suit your purposes. You can either edit the placeholder text or put a single space in the placeholder to avoid this problem.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote