Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Jan 2016
    Posts
    77
    Thanks
    18
    Thanked 1 Time in 1 Post

    VBA Character Webdings

    Folks,

    good day to all.

    I am baffled by the webdings character 52 the right arrow

    It is also the number 87 and also represents the number 4

    So I'm really confused

    it doesn't work when in a macro.

    Any ideas?

    Code:
    Sub DeletePara()
    
    ' Delete Paragraphs that have the Webding Character 52 in them
    Dim oPara As Paragraph
        For Each oPara In ActiveDocument.Paragraphs
            If InStr(1, oPara.Range.Text, Chr(52)) > 0 Then
                oPara.Range.Delete
            End If
        Next
    End Sub
    thanks
    pb

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Working with Unicode characters and special characters such as Webdings requires special treatment because they actually use parts of the character table that Word protects from normal access. Try:
    Code:
    Sub DeletePara()
      ' Delete Paragraphs that have the Webding Character 52 in them
      Dim oPara As Paragraph
      For Each oPara In ActiveDocument.Paragraphs
        With oPara.Range
          With .Find
            .ClearFormatting
            .Text = ChrW(&HF034)
            .Format = False
            .Forward = True
            .Wrap = wdFindStop
            .Execute
          End With
          If .Find.Found Then
            .Select
            If Dialogs(wdDialogInsertSymbol).Font = "Webdings" Then _
              Selection.Paragraphs(1).Range.Delete
          End If
        End With
      Next
    End Sub
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. #3
    Star Lounger
    Join Date
    Jan 2016
    Posts
    77
    Thanks
    18
    Thanked 1 Time in 1 Post
    Thanks Paul,

    i looked everywhere - I followed the protocol and even tried to convert it to a hex version.

    oh well - I may have to think of substituting the webdings for some thing else if its going to be this trouble some


    cheers


    pb

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    I'm not sure it's especially troublesome; it's just a case of knowing how to go about it.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •