Cross ref to a bookmark in a cell in a header

H

hgoslin

Hi
I have cross referenced a bookmark to reflect the bookmarked text in a
header. The bookmark is in a cell in a table. I need only the
bookmarked text ie not the table cell to display in the header. Each
time I update fields the single cell table reappears in the header.

I have tried to write a macro that converts the table to text after
updating fields but the table reappears as soon as the Print Layout
view switches on.

Here is the code:

With ActiveDocument.Sections(4).Headers(wdHeaderFooterPrimary)

ActiveDocument.Sections(4).Headers(wdHeaderFooterPrimary).Range.Tables(1).Columns(1).Cells(1).Select

Selection.Rows.ConvertToText Separator:=wdSeparateByParagraphs, _
NestedTables:=True
End With
ActiveWindow.ActivePane.Close
If ActiveWindow.View.SplitSpecial = wdPaneNone Then
ActiveWindow.ActivePane.View.Type = wdPrintView
Else
ActiveWindow.View.Type = wdPrintView
End If

I would greatly appreciate help either to prevent the table showwing in
the first place or how to get rid of it in my header.
Thanks
Heather
 
H

hgoslin

Hi Ann
The bookmark selects and empty cell originally as I am using it to
assign text from a userform textbox. I wonder if the best work around
would rather be to put the bookmark in the header and cross reference
it in the table. It goes against the grain as all the other cells in
the table are populated by the userform.
Thanks
Heather
 
A

Anne Troy

Again... it still sounds like you've got the bookmark as the entire cell,
and you don't need to. Delete the current bookmark. Place your cursor inside
the table cell (do not select the cell) and insert the bookmark again. I
could be wrong, but it seems this should fix it.
************
Anne Troy
www.OfficeArticles.com
 
H

hgoslin

Hi Ann
The whole cell was selected - the end cell marker was contained in the
bookmark.
Thanks for the help.
Heather
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top