合併文檔時讓第一頁爲奇數

目的:實現打印時自動將第一頁排在奇數頁,以防出現兩份資料不獨立的情況。
因爲是雙面打印,故必須讓文檔的第一頁位於奇數頁,可以獲取頁碼,插入空白頁,可以插入奇數頁分頁符
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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章