OVH Cloud OVH Cloud

how to write in a table in a footer ?

2 réponses
Avatar
MM
Hi all !

I'm looking for a way to write in a table in a footer in vba.
I open my word doc from access and write things in it but i don't know how
to write in a footer.
I'd better not use Shapes and selection because i found it it is not very
reliable.

Thanx for your help !

2 réponses

Avatar
Guy Moncomble
Bonjour à tous,
dans le message : belvsu$cap$,

| Hi all !
|
| I'm looking for a way to write in a table in a footer in vba.
| I open my word doc from access and write things in it but i don't
| know how to write in a footer.
| I'd better not use Shapes and selection because i found it it is not
| very reliable.
|
| Thanx for your help !

Hello, try this.

Public Sub JohnDoe()
'Assume cursor is on the page you want to update
'Navigate from footer to footer is a little more complicated
'Open the footer
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
'Select all the footer
Selection.WholeStory
'Write in the first cell on the first row. We suppose that there is
only one table in the footer
Selection.Tables(1).Cell(1, 1).Range.Text = "toto"
'Return to main doc
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub


Hope this helps.
--
A+

GMO MVP Word

Et surtout :
- ne lisez pas le manuel de Word, encore moins l'aide
- ne réfléchissez pas au problème qui se pose à vous
- expliquez le plus confusément possible les phénomènes constatés
- exigez une réponse immédiate
- expliquez à celui qui vous aide comment et pourquoi il aurait
du appliquer *votre* solution (qui évidemment ne marche pas)
- niez l'évidence : la solution qu'un bénévole a parfois mis des
heures à mettre au point ne marche pas chez vous qui l'appliquez mal
depuis 2 minutes.
- ne dites ni bonjour ni merci
- ne perdez pas la face : ne faites savoir à personne que vous
avez été dépanné

- insultez les contributeurs bénévoles, ils ne veulent pas
l'avouer, mais ils adorent cela. Si c'est un MVP vous avez un bonus.
Avatar
MM
Merci bcp, désolé pour les non-anglophones :)

J'ai utilisé ca, ce qui est pas mal aussi, mais je prend note, le concept
des selection sembla pas mal :) :

With owd.Sections(1).Footers(wdHeaderFooterPrimary).Range.Tables(1)
.Cell(2, 1).Range.Text = rs.Fields(0)
.Cell(2, 2).Range.Text = rs.Fields(1)
.Cell(2, 3).Range.Text = rs.Fields(2)
.Cell(2, 4).Range.Text = rs.Fields(3)
End With

Encore merci !


"Guy Moncomble" a écrit dans le message
de news:
Bonjour à tous,
dans le message : belvsu$cap$,

| Hi all !
|
| I'm looking for a way to write in a table in a footer in vba.
| I open my word doc from access and write things in it but i don't
| know how to write in a footer.
| I'd better not use Shapes and selection because i found it it is not
| very reliable.
|
| Thanx for your help !

Hello, try this.

Public Sub JohnDoe()
'Assume cursor is on the page you want to update
'Navigate from footer to footer is a little more complicated
'Open the footer
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
'Select all the footer
Selection.WholeStory
'Write in the first cell on the first row. We suppose that there is
only one table in the footer
Selection.Tables(1).Cell(1, 1).Range.Text = "toto"
'Return to main doc
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub


Hope this helps.
--
A+

GMO MVP Word

Et surtout :
- ne lisez pas le manuel de Word, encore moins l'aide
- ne réfléchissez pas au problème qui se pose à vous
- expliquez le plus confusément possible les phénomènes constatés
- exigez une réponse immédiate
- expliquez à celui qui vous aide comment et pourquoi il aurait
du appliquer *votre* solution (qui évidemment ne marche pas)
- niez l'évidence : la solution qu'un bénévole a parfois mis des
heures à mettre au point ne marche pas chez vous qui l'appliquez mal
depuis 2 minutes.
- ne dites ni bonjour ni merci
- ne perdez pas la face : ne faites savoir à personne que vous
avez été dépanné

- insultez les contributeurs bénévoles, ils ne veulent pas
l'avouer, mais ils adorent cela. Si c'est un MVP vous avez un bonus.