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


0