目的:实现打印时自动将第一页排在奇数页,以防出现两份资料不独立的情况。</pre><pre name="code" class="vb">因为是双面打印,故必须让文档的第一页位于奇数页,可以获取页码,插入空白页,可以插入奇数页分页符
Sub 合并文档时让第一页为奇数() 'ThisDocument.BuiltInDocumentProperties(wdPropertyPages) Rem Selection.Information(wdNumberOfPagesInDocument) Rem ActiveDocument.ComputeStatistics(wdStatisticPages) Rem ActiveDocument.ActiveWindow.ActivePane.Pages.Count With Application.FileDialog(msoFileDialogFilePicker) If .Show <> -1 Then Exit Sub For Each f In .SelectedItems Selection.InsertFile f Selection.InsertBreak Type:=wdSectionBreakOddPage '插入奇数页分节符 wdSectionBreakEvenPage '插入偶数页分节符 'If ActiveDocument.content.Information(wdNumberOfPagesInDocument) Mod 2 <> 0 Then ' ActiveDocument.content.InsertBreak Type:=wdPageBreak 'End If Next End With End Sub