looking for the right syntax to access a cell in a footer ?

here's what I've tried with no success...
Set Rng = ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
with rng.table(1).cell(2,2)
.text = "updated on february 25"
end with

Merci !

RE: Update table cell in footer ! by lf

lf
Mon Feb 25 13:58:02 PST 2008

Replace the line:
With rng.table(1).cell(2,2)

with this line:
With rng.Tables(1).Cell(2, 2).Range

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


"Grenier" wrote:

> looking for the right syntax to access a cell in a footer ?
>
> here's what I've tried with no success...
> Set Rng = ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
> with rng.table(1).cell(2,2)
> .text = "updated on february 25"
> end with
>
> Merci !

Re: Update table cell in footer ! by Doug

Doug
Mon Feb 25 14:00:45 PST 2008

A cell does not have a .Text attribute. It is the .Text attribute for the
.Range of the cell that you must use.

ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Tables(1).Cell(2,2).Range.Text
= "updated on february 25"

--
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

"Grenier" <Grenier@discussions.microsoft.com> wrote in message
news:38A4CBF5-9FBE-45E4-888C-DBFFAC32BEB7@microsoft.com...
> looking for the right syntax to access a cell in a footer ?
>
> here's what I've tried with no success...
> Set Rng = ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
> with rng.table(1).cell(2,2)
> .text = "updated on february 25"
> end with
>
> Merci !



Re: Update table cell in footer ! by Grenier

Grenier
Mon Feb 25 15:25:02 PST 2008

tried it both way and still does not work ...

ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Tables(1).Cell(2,2).Range.Text = "updated on february 25"

Set rng = ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
With rng.Tables(1).Cell(1, 1).Range
.Text = "updated on february 25"
End With

any guess ?


Re: Update table cell in footer ! by lf

lf
Mon Feb 25 15:35:01 PST 2008

Are you sure the footer that contains the table is a wdHeaderFooterPrimary?
For example, if you have set a different first page and the table is in the
footer of the first page, it is a wdHeaderFooterFirstPage.

--
Regards
Lene Fredborg
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


"Grenier" wrote:

> tried it both way and still does not work ...
>
> ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Tables(1).Cell(2,2).Range.Text = "updated on february 25"
>
> Set rng = ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
> With rng.Tables(1).Cell(1, 1).Range
> .Text = "updated on february 25"
> End With
>
> any guess ?
>

Re: Update table cell in footer ! by Grenier

Grenier
Tue Feb 26 10:46:06 PST 2008

Manage to get it working with the following syntax.

Dim rng As Range
Dim TblFooter As Table

Set TblFooter =
ActiveDocument.Sections(3).Footers(wdHeaderFooterFirstPage).Range.Tables(1)
Set Rng = TblFooter.Cell(1, 1).Range
Rng.Text = "Updated on ......"

Found out that the syntax you gave me only worked with a document created by
hand. My original document is created by Access via automation... can't
figure out the difference but you pointed me in the right direction. Thank's !


"Lene Fredborg" wrote:

> Are you sure the footer that contains the table is a wdHeaderFooterPrimary?
> For example, if you have set a different first page and the table is in the
> footer of the first page, it is a wdHeaderFooterFirstPage.


Re: Update table cell in footer ! by Doug

Doug
Tue Feb 26 11:12:16 PST 2008

Obviously the table into which you wanted to insert the data was in Section
3, not Section 1.

--
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

"Grenier" <Grenier@discussions.microsoft.com> wrote in message
news:E4E7DC31-1052-4FA2-9FBC-92281700FB36@microsoft.com...
> Manage to get it working with the following syntax.
>
> Dim rng As Range
> Dim TblFooter As Table
>
> Set TblFooter =
> ActiveDocument.Sections(3).Footers(wdHeaderFooterFirstPage).Range.Tables(1)
> Set Rng = TblFooter.Cell(1, 1).Range
> Rng.Text = "Updated on ......"
>
> Found out that the syntax you gave me only worked with a document created
> by
> hand. My original document is created by Access via automation... can't
> figure out the difference but you pointed me in the right direction.
> Thank's !
>
>
> "Lene Fredborg" wrote:
>
>> Are you sure the footer that contains the table is a
>> wdHeaderFooterPrimary?
>> For example, if you have set a different first page and the table is in
>> the
>> footer of the first page, it is a wdHeaderFooterFirstPage.
>