View Single Post
 
Old 01-07-2015, 03:44 PM
jjfreedman jjfreedman is offline Windows 7 64bit Office 2013
Advanced Beginner
 
Join Date: May 2012
Location: https://jay-freedman.info
Posts: 39
jjfreedman is on a distinguished road
Default

When you collapse the Selection, that excludes the field that you just inserted, and in turn the field is excluded from objRange -- that's why it doesn't appear in the building block.

Replace this part of your code

Code:
    ' Collapse the range, set the range, and add the text
    Selection.Collapse
    Set objRange = Selection.Range
 
    objRange.Text = "Building blocks for the technically challenged"
with this:

Code:
    ' Collapse the range, set the range, and add the text
    Selection.Collapse
    Set objRange = Selection.Range
 
    objRange.Text = vbCr & "Building blocks for the technically challenged"
    objRange.MoveStart unit:=wdCharacter, Count:=-1
That works for me. If the "technically challenged" text appears for you before the chart instead of after it, you'd have to replace the MoveStart with MoveEnd and change the Count value from -1 to 1. (Just as when using the mouse or arrow keys, selecting just the opening or closing field marker automatically selects the entire field.)
Reply With Quote