Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jan 2007
    Location
    Denmark
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am making a macro that tags all the styles in a document so that I can strip the formatting by putting it through Note Pad. In the second macro, I convert the stripped text to the original formatting and delete the tags. My main font is Arial. So far so good.

    In the documents, there are mathematical symbols, such as arrows. I find them in the “Symbols” font.

    I need to turn the symbols into text, e.g. <right_arrow>, because when they are put through Note Pad, the symbol is lost. That works fine in the first macro with this:

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = ChrW(61611)
    .Replacement.Text = "<arrow_double>"
    .Forward = True
    .Wrap = wdFindContinue
    End With
    Selection.Find.Execute
    With Selection
    If .Find.Forward = True Then
    .Collapse Direction:=wdCollapseStart
    Else
    .Collapse Direction:=wdCollapseEnd
    End If
    .Find.Execute Replace:=wdReplaceOne
    If .Find.Forward = True Then
    .Collapse Direction:=wdCollapseEnd
    Else
    .Collapse Direction:=wdCollapseStart
    End If
    .Find.Execute
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    The macro recorder did that for me. But it will not work in reverse, i.e. turning the tag back into the symbol. I’ve worked out this macro which works individually on each instance.

    ‘2192 Rightwards Arrow
    Selection.Find.ClearFormatting
    With Selection.Find
    .Text = "<arrow_right>"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    End With
    Selection.Find.Execute
    Selection.TypeText Text:="2190"
    Selection.ToggleCharacterCode

    Can I turn this into a loop? There must be a better way to do it than the above. I have trouble figuring out the unicode aspects of this.

    Thanks for your help.

    Cheers, Bill

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts
    Am locking thread. See responses posted to identical post in Visual Basic for Apps forum.

    Gary

Posting Permissions

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