hexagon logo

Problem: Get Comment lines count

Hi everyone,

Can anyone tell me the easyest way to get the number of lines of a comment?

Set PCDComment = PCDCommand.CommentCommand


For z = 1 To 10
If PCDComment.GetLine(z) Then cnt = z Else Exit For
Next z


This doesnt work. Is there something like PCDComment.Lines.count (obviously i tried this one already)?

Have a nice day,

Laurent
Parents Reply Children
  • The comment command doesn't support the GetDataType property. You will need to use the command from which the comment was obtained from. The below was used to remove Inspection Expert comments from a program

    For Each oCmd In oCmds
    If oCmd.IsComment Then
    Set oCmntCmd = oCmd.CommentCommand
    With oCmntCmd
    If .CommentType = 1 Then '1=report
    For i = 1 To oCmd.GetDataTypeCount(COMMENT_FIELD)
    sTxt = .GetLine(i)
    If InStr(1, UCase(sTxt), "[ITEM") Then
    bRet = .RemoveLine(i)
    End If
    Next i
    If .Comment = "" Then
    oCmd.Remove
    End If
    End If
    End With
    End If
    Next oCmd