View Single Post
  #3   Report Post  
Max Moor
 
Posts: n/a
Default

"Jezebel" wrote in
:

When you insert a cross-reference to a heading, Word creates a hidden
bookmark for that heading. This is the _Ref12345678 part of your REF
field code. (The leading underscore is what makes it a hidden
bookmark. You can see these on the Bookmarks dialog by checking the
'Hidden Bookmarks' checkbox.)

You can use this _Ref code to retrieve the heading itself, and thus
its style and other properties --

Dim pRef as string
:
pRef = mid$(oRg.Fields(1).Code, 6, 13)
ActiveDocument.Bookmarks.ShowHidden = TRUE
pStyle = ActiveDocument.Bookmarks(pRef).Range.Style


The Mid$() finction is dubious here -- it would be more reliable to
use Split() or Instr() to extract the reference.



Split(oRg.Fields(1).Code)(2) it is. Once again, thanks for the help. I
know that once this code is working, it will repeatedly save me hours of
time over the years. As I found with Access, you MVPs make the learning
curve so much more bearable.

- Max