WORD VBA 每一页第一段文字

'所有页码

pages = ActiveDocument.ActiveWindow.Panes(1).Pages.Count
   For i = 1 To pages

      '下一页,选中
       ActiveDocument.GoTo(wdGoToPage, wdGoToAbsolute, i).Select
        p = Selection.Information(wdActiveEndPageNumber) '当前页码
        
        ‘所在页第一段选中
         ActiveDocument.Bookmarks("\page").Range.Paragraphs.Item(1).Range.Select
         
        ‘字体
         font_name = ActiveDocument.Bookmarks("\page").Range.Paragraphs.Item(1).Range.Font.Name
        ’大小
         font_size = ActiveDocument.Bookmarks("\page").Range.Paragraphs.Item(1).Range.Font.Size
        ‘内容
         txt = ActiveDocument.Bookmarks("\page").Range.Paragraphs.Item(1).Range.Text
         
        If font_name = "黑体" Then
            If font_size = 16 Then
            
                 Selection.InsertNewPage
                 i = i + 1
                 
    If bl = False Then
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    End If
    
    
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeParagraph
    Selection.TypeText Text:="*****"
    
    
            End If
        End If
        

 

你可能感兴趣的:(VBA,VBA,WORD)