Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-04-2013, 05:16 PM
macropod's Avatar
macropod macropod is offline Adding field in word in header in a bookmark in table with Excel vba Late Binding Windows 7 64bit Adding field in word in header in a bookmark in table with Excel vba Late Binding Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

I assume you're trying to populate the bookmarked range. In that case, instead of:
Code:
    With objWord
... 
    End With
try something along the lines of:
Code:
    With objDoc
        Dim wdRng As objWord.Range, StrBkMkNm As String
        StrBkMkNm = "MySpots"
        Set wdRng = .Bookmarks("MySpots").Range
         'Insert header (bookmark MySpot is in Header, Bookmark Myspots is in table in header, Bookmark MyReference is in normal text)
        .Fields.Add Range:=.Bookmarks(StrBkMkNm).Range, Type:=wdFieldEmpty, Text:="REF MyReference \*Charformat", PreserveFormatting:=False
        .Bookmarks.Add Range:=wdRng, Name:=StrBkMkNm
    End With
That said, is there a reason you can't use a pre-configured template, with the cross-references etc already in place? You might also consider using a unique Style for the source content and StyleRef field in the header instead of a REF field.

Note also that there is no need to 'seek' the header or to select anything.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding field in word in header in a bookmark in table with Excel vba Late Binding Open header to insert text into bookmark Amapola188 Word VBA 3 07-12-2012 05:16 PM
Excel Pivot Table Calculated Field BertLady Excel 0 05-21-2012 10:51 AM
Late Binding on SHDocVw tinfanide Excel Programming 1 05-19-2012 10:00 PM
Adding field in word in header in a bookmark in table with Excel vba Late Binding Putting a bookmark on a REF field in the selection b0x4it Word VBA 4 05-26-2011 01:14 AM
Adding field in word in header in a bookmark in table with Excel vba Late Binding Highlight and put bookmark on the closest field to the cursor b0x4it Word VBA 11 05-19-2011 11:15 PM

Other Forums: Access Forums

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