Visual Basic para Aplicaciones - Numerar paginas en word

Life is soft - evento anual de software empresarial
 
Vista:

Numerar paginas en word

Publicado por Ivan (1 intervención) el 17/10/2016 15:05:32
Buenas tardes,

Tengo un pie de página hecho en word con VB. Y resulta que quisiera que añadiera el número de página actual, el problema es que siempre me pone el mismo número, no incrementa.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Private Sub lbldibc_Click()
Dim rango As Range
Dim x As String
 
Set rango = ActiveDocument.Range(0, Selection.End)
x = rango.ComputeStatistics(wdStatisticPages)
 
 
LBLPIE.Caption = txtof1.Text & txtof2.Text & "-" & txtof3.Text & " " & TXTCLIENTE.Text & " " & TXTDIP.Text & " " & txtfd.Text & "/" & txtfm.Text & "/" & txtfa.Text & " " & cbotipo.Text & " " & "Esta es la pagina" & " " & x
LBLIR.Caption = txtof1.Text & txtof2.Text
lblrev.Caption = txtof3.Text
lblcliente.Caption = TXTCLIENTE.Text
lbltiporev.Caption = cbotipo.Text
lblrcpc.Caption = TXTRCP.Text
lbldibc.Caption = TXTDIP.Text
 
 
    Selection.GoTo What:=wdGoToBookmark, Name:="tablita"
    With ActiveDocument.Bookmarks
        .DefaultSorting = wdSortByName
        .ShowHidden = False
    End With
    Selection.Fields.Update
 
 
 
If cbotipo.Text = "TECHNICAL OFFER" Then LBLPIE.Caption = ""


Muchas gracias de antemano
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Numerar paginas en word

Publicado por Oscar Rubió (19 intervenciones) el 24/11/2016 19:24:09
Deberías ponerle un bucle a LBLPIE, tal que así:

1
2
3
For i=1 to x
     LBLPIE.Caption = txtof1.Text & txtof2.Text & "-" & txtof3.Text & " " & TXTCLIENTE.Text & " " & TXTDIP.Text & " " & txtfd.Text & "/" & txtfm.Text & "/" & txtfa.Text & " " & cbotipo.Text & " " & "Esta es la pagina " &  i & " de " & x
Next i
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar