Здравствуйте!
Не выводил ли кто-нибудь отчёт в Word в несколько колонок? Что-то не получается с середины текста перед таблицей разбить страницу на две колонки, а потом после таблицы вернуть опять одну.
Макрос сначала такой:
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.MoveRight Unit:=wdCharacter, Count:=5, Extend:=wdExtend
Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.MoveRight Unit:=wdCharacter, Count:=4, Extend:=wdExtend
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type <> wdPrintView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveDocument.Range(Start:=Selection.Start, End:=Selection.Start). _
InsertBreak Type:=wdSectionBreakContinuous
Selection.Start = Selection.Start + 1
ActiveDocument.Range(Start:=Selection.End, End:=Selection.End).InsertBreak _
Type:=wdSectionBreakContinuous
With Selection.PageSetup.TextColumns
.SetCount NumColumns:=2
.EvenlySpaced = True
.LineBetween = False
.Width = CentimetersToPoints(7.62)
.Spacing = CentimetersToPoints(1.25)
End With
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.EscapeKey
End Sub
Sub Макрос1()
'
Потом такой
' Макрос1 Макрос
'
'
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type <> wdPrintView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
With ActiveDocument.Range(Start:=Selection.Start, End:=ActiveDocument. _
Content.End).PageSetup.TextColumns
.SetCount NumColumns:=1
.EvenlySpaced = True
.LineBetween = False
.Width = CentimetersToPoints(16.5)
End With
Selection.TypeText Text:="Текст"
End Sub
Чтобы получилось, как в прилагаемом файле.