HasTag Script

Build 1501 on 14/Nov/2017  This topic last edited on: 9/May/2012, at 13:03

Description

Looks up for the tag name in the current format.

Returns 0 if not found, or 1 for paragraph style, 2 for character style, 3 for hidden style.

Syntax

HasTag(strTagName)

strTagName

tag name of the style you're looking for

Code

Public Function HasTag(ByVal strTagName)

  ' lookup for tag name in current format, returns 0 if not found

  ' or 1=para style; 2=character style; 3=hidden style

  Dim objFormat = Ted.GetFormat

   objFormat.Id = Ted.GetActiveTxt.FormatId

  Dim aParaStyles = objFormat.ParaStyles

 

  For Each Style As String In objFormat.ParaStyles

    If Style = strTagName Then Return 1

  Next

 

  Dim aTextStyles = objFormat.TextStyles

  For Each Style As String In objFormat.TextStyles

    If Style = strTagName Then Return 2

  Next

 

  Dim aMacros = objFormat.Macros

  For Each Style As String In objFormat.Macros

    If Style = strTagName Then Return 3

  Next

  Return 0

End Function

See also

HasTagInPara, HasTagInString, sysHasParaTags