VBAはどのようにWORDドキュメントの指定ページを得て第何節にありますか?[


VBAはどのようにWORDドキュメントの指定ページを得て第何節にありますか?
Function SectionNumber(PageNumber As Long) As Long     Dim myRange As Range     Set myRange = ActiveDocument.GoTo(what:=wdGoToPage, which:=wdGoToAbsolute, Count:=PageNumber)     SectionNumber = myRange.Sections(1).Index End Function
次の手順でテストできます.
VB code

    
    
    
    
Sub Test() Dim lCount As Long , i As Long lCount = ActiveDocument.ActiveWindow.Panes( 1 ).Pages.Count For i = 1 To lCount Debug.Print " Page: " & i & " , Section: " & SectionNumber(i) Next i

    
    
    
    
:http://topic.csdn.net/u/20090630/17/d570d428-6735-4b79-bf1f-980f70d0f91a.html