2017-12-28 66 views
0

VBAを使用して通常のMSワード段落について何かしたいと思います。しかし、表示モードの式は、段落のように見えます。誰かが私に教えてくれますか、違いますか?または、それらを区別するVBAの例を提供してください。MSワードの段落を表示モードの式から教える方法

enter image description here

Function IsADisplayModeEquation(ParagraphIndex As Long) 
    Dim ParagrapLineNum As Long 
    Dim EquationLineNum As Long 
    ParagrapLineNum = ActiveDocument.Paragraphs(ParagraphIndex).Range.Information(wdFirstCharacterLineNumber) 

    n = ActiveDocument.Bookmarks("\page").Range.OMaths.Count 
    For I = 1 To n 
     EquationLineNum = ActiveDocument.Bookmarks("\page").Range.OMaths(I).Range.Information(wdFirstCharacterLineNumber) 
     If (ParagrapLineNum = EquationLineNum) And ActiveDocument.Bookmarks("\page").Range.OMaths(I).Type = wdOMathDisplay Then 
      IsADisplayModeEquation = True 
      Exit Function 
     End If 
    Next I 
    IsADisplayModeEquation = False 
End Function 

答えて

0

醜い関数:

Function IsADisplayModeEquation(ParagraphIndex As Long) 
    Dim ParagrapLineNum As Long 
    Dim EquationLineNum As Long 
    ParagrapLineNum = ActiveDocument.Paragraphs(ParagraphIndex).Range.Information(wdFirstCharacterLineNumber) 

    n = ActiveDocument.Bookmarks("\page").Range.OMaths.Count 
    For I = 1 To n 
     EquationLineNum = ActiveDocument.Bookmarks("\page").Range.OMaths(I).Range.Information(wdFirstCharacterLineNumber) 
     If (ParagrapLineNum = EquationLineNum) And ActiveDocument.Bookmarks("\page").Range.OMaths(I).Type = wdOMathDisplay Then 
      IsADisplayModeEquation = True 
      Exit Function 
     End If 
    Next I 
    IsADisplayModeEquation = False 
End Function 
関連する問題