How do I acess a table in the header programmatically?

R

richard.jolly

I'm trying access through VBA an existing table in the header. I need
to pass a variable from another routine (that have completed and is
working).

The existing table is only 1 row with 2 columns (the RH cell has a
graphic in there that needs to stay there) I want to pass the variable
to the LH cell.

I have tried using the sections header.range.text but this just places
the variable underneath the table.

Many Thanks

Richard Jolly
 
J

Jean-Guy Marcil

(e-mail address removed) was telling us:
(e-mail address removed) nous racontait que :
I'm trying access through VBA an existing table in the header. I need
to pass a variable from another routine (that have completed and is
working).

The existing table is only 1 row with 2 columns (the RH cell has a
graphic in there that needs to stay there) I want to pass the variable
to the LH cell.

I have tried using the sections header.range.text but this just places
the variable underneath the table.

Try (assuming the sections number is static, that yu want to get to the man
header and that there is only one table in the said header):

ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
.Range.Tables(1).Cell(1, 1).Range.Text = "Your Text!"


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
R

richard.jolly

Jean-Guy Marcil said:
(e-mail address removed) was telling us:
(e-mail address removed) nous racontait que :


Try (assuming the sections number is static, that yu want to get to the man
header and that there is only one table in the said header):

ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary) _
.Range.Tables(1).Cell(1, 1).Range.Text = "Your Text!"


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org

Thank you - works a treat.Sorry for the double posting -didn't know the
best area to post it
 

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