Word - error de compilacion se esperaba End Sub

 
Vista:

error de compilacion se esperaba End Sub

Publicado por CARLOS (3 intervenciones) el 25/03/2019 18:52:00
Tengo un error de compilacion en la siguiente macro realizado en word, me dice error de compilacion se esperaba End Sub.


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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Sub AjustarDocumento()
    Dim xPage As Long, nPage As Long, xPar As Boolean
    nPage = ActiveDocument.ActiveWindow.Panes(1).Pages.Count
 
    Selection.HomeKey Unit:=wdStory
    Bloque1
    If nPage > 1 Then
        For xPage = 2 To nPage
            Application.Browser.Next
            ActiveDocument.Range( _
                Start:=Selection.Start, _
                End:=Selection.Start). _
                InsertBreak Type:=wdSectionBreakNextPage
            Selection.Start = Selection.Start + 1
 
            If xPar Then
                xPar = False
                Bloque2
            Else
                xPar = True
                Bloque1
            End If
        Next xPage
    End If
End Sub
 
Sub Bloque1()
    With ActiveDocument.Range( _
                Start:=Selection.Start, _
                End:=ActiveDocument.Content.End).PageSetup
        .TopMargin = CentimetersToPoints(2.5)
        .BottomMargin = CentimetersToPoints(2.5)
        .LeftMargin = CentimetersToPoints(4)
        .RightMargin = CentimetersToPoints(2)
    End With
End Sub
 
Sub Bloque2()
    With ActiveDocument.Range( _
                Start:=Selection.Start, _
                End:=ActiveDocument.Content.End).PageSetup
        .TopMargin = CentimetersToPoints(2.5)
        .BottomMargin = CentimetersToPoints(2.5)
        .LeftMargin = CentimetersToPoints(2)
        .RightMargin = CentimetersToPoints(4)
    End With
End Sub
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
Imágen de perfil de Antoni Masana
Val: 147
Ha mantenido su posición en Word (en relación al último mes)
Gráfica de Word

error de compilacion se esperaba End Sub

Publicado por Antoni Masana (205 intervenciones) el 26/03/2019 16:22:11
No le veo ningún error.

Quizás seria mejor si subieses el libro.


Saludos
\\//_
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar

error de compilacion se esperaba End Sub

Publicado por crgaleas (3 intervenciones) el 28/03/2019 06:26:07
Gracias, tiene razon, me puede recomendar una macro con cuadro de dialogo donde me pida en que linea deseo iniciar a elaborar el documento de word?
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