add one line at the end of a footer

4

4tis

hi
i need to add a new line (with some text) to the end of the footer in
word (first page and other page).
i need to add this line without changing the formating of the footer (i
have a table in the footer)
i tried some things and nothing worked
how can i do this ?
 
D

Doug Robbins - Word MVP

I am assuming that you want to use VBA to do this.

I would insert a { DOCVARIABLE varname } field in the footer where you want
the information to appear and then use

Dim i as Long
With ActiveDocument
.Variables("varname").Value = "Your line of text"
For i = 1 to .Sections.Count
.Sections(i).Footers(wdHeaderFooterFirstPage).Range.Fields.Update
.Sections(i).Footers(wdHeaderFooterPrimary).Range.Fields.Update
Next i
End With

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
4

4tis

thanks
and how can i add this { DOCVARIABLE varname } to the footer via VBA
code and find if it exist ?
i dont have any clew with this variable but it seems that this is
exactly what i am looking for
thanks
 
4

4tis

thanks
and how can i add this { DOCVARIABLE varname } to the footer via VBA
code and find if it exist ?
i dont have any clew with this variable but it seems that this is
exactly what i am looking for
thanks
 
D

Doug Robbins - Word MVP

Insert the field in the template manually from the Insert>Field menu or by
pressing Ctrl+F9 to insert a pair of field delimiters and typing the
DOCVARIABLE varname inside them and then using Alt+F9 to toggle off the
display of the field codes. Then when the macro is run, the information
that is stored in the variable by the code in the macro will be displayed

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
4

4tis

thanks
it was realy helping
this is exactly what i was needed
i just did not knew about fields in word
 

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