![]() |
|
#1
|
||||
|
||||
![]() I'm sure there will be a more elegant way to do this but this is my first attempt Code:
Sub DemoReplaceBookmark() Dim aRng As Range, aField As Field Set aRng = ActiveDocument.Bookmarks("aaa").Range Set aField = ActiveDocument.Fields.Add(Range:=aRng, Text:="DocProperty Title") aRng.InsertBefore "text in front" aRng.End = aField.Result.End aRng.InsertAfter "text at end" 'aRng.Select ActiveDocument.Bookmarks.Add Name:="aaa", Range:=aRng End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#2
|
|||
|
|||
![]()
@Guessed :
Your sollution extends the field with the text that is inserted after the field. I tried if a range.collapse after range.end=field.result.end, but that gave the same result any sugestions? |
![]() |
Tags |
bookmark;content control, field |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
JonFleming | Word VBA | 9 | 02-09-2016 05:22 AM |
![]() |
Byron Polk | Word VBA | 10 | 08-19-2014 07:19 AM |
Custom Document Property Lost From Template | bhaughey | Word | 8 | 03-05-2013 02:11 PM |
Link Watermark to custom property | kerend | Word | 0 | 04-08-2012 05:03 AM |
![]() |
untttt | Word | 2 | 06-09-2011 05:24 PM |