0
votes

TO MODERATORS: My questions have been blocked because out of control "community" (mostly "Halfer" [full]) has been through every one of my posts, years later, and made ridiculous trivial edits to serious questions that I have been unable to solve, carefully composed, and have often answered myself. Some have over 2k hits.

I will be happy to replace my questions and answers with a screenshot of the ridiculous edits, until this is rectified.

YOU NEED TO CONTROL OUT OF CONTROL COMMUNITY EDITS AND UNBLOCK SERIOUS USERS.

It's a coding site, not a spelling test. If you want to tidy posts, fine, but sort your banning algorithm out, tell contributors WHY they have been banned and give them warning, and provide a means for victims to flag unjustified edits and downvotes. They need to be fair or your site will lose the time and effort put in by valuable contributors.

1 2 3

I need to find footnote and endnote marks (in the body, to format them and re-link them) etc, in a macro I have written to clean up documents imported from the web.

My macro works fine, except where part of the find string is hyperlink display text and part is not.

Searching for ([a-z])([0-9]) (to locate endnote marks in the body, as they are not formatted as endnotes) does not find them because [0-9] is hyperlink display text and [a-z] is not.

  1. My question here: how to search for [normal string] adjacent to [hyperlink display text string]?
  2. If found, the next step is how to replace the hyperlink display text (format endnotes superscript, delete the para mark) keeping it in the hyperlink (I can work on that - maybe the subject of another question?)
1
Presumably, your hyperlinks are still pointing to some web address, in which case you should be unlinking them before doing your Find/Replace. You may also be interested in: msofficeforums.com/40799-post4.html & msofficeforums.com/110511-post2.htmlmacropod
Thank you Paul, De-linking is a perfect solution for the footnote or endnote marks (they are plain text without superscript or brackets so I can't see how to make your brilliant macros work), but not for other hyperlinks containing para marks - I need to keep those links :) - any further ideas? VickiPiecevcake
If I could find all hyperlinks containing a number only and superscript them maybe your macros would work? (Strangely, the marks in the endnotes themselves are superscript, while in the body they are normal style.Piecevcake
The macros in the links I posted would likely require the unlinking to be done beforehand. You can unlink every field via Ctrl-A, F9. Or you could use a macro to unlink just hyperlinks whose display text is numeric. I'm curious, though as to why you'd have references in the [a-z][0-9] format.macropod
I am having trouble working out a macro which acts only on display text containing a number only, (and would it catch auto paragraph numbering which also displays numbers only?) ... In answer to your question, my endnote marks do contain only numbers, I was being clever trying to find the marks by searching for numbers not separated from the preceding text... hence my original question...Piecevcake

1 Answers

2
votes

You could, of course, simply convert your hyperlinks to superscripted numbers then use whatever other code you have to replace the superscripted numbers with endnotes.

Sub Demo()
Dim h As Long
With ActiveDocument
  For h = .Hyperlinks.Count To 1 Step -1
    With .Hyperlinks(h)
      If IsNumeric(.TextToDisplay) = True Then
        With .Range
          If .Characters.First.Previous Like "[a-z]" Then
            .Fields.Unlink
            .Font.Reset
            .Font.Superscript = True
          End If
        End With
      End If
    End With
  Next
End With
End Sub

Depending on what you're doing, you could simply insert your endnoting code into the inner If ... End If construct in place of the font manipulations.