View Single Post
  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Peter T. Daniels Peter T. Daniels is offline
external usenet poster
 
Posts: 3,215
Default Wildcard "special" searches

Why would I want to cut and paste the footnote, instead of cutting and
pasting the punctuation mark? (If Track Changes were on, it would
create tremendous havoc in the notes, because it gives a number to
both a deleted and an inserted copy of the same note.)

And it would be better to do them individually rather than all at
once.

The reason for the wild card is so that I can put the cursor between
the note and the following period, comma, etc., and press Ctrl-T (the
shortcut I assigned to the Transpose macro). Is there some other way
to accomplish that?

If it has to be a separate macro, I can give it Ctrl-Shift-T. If that
comes assigned to something, it's not something I use! (Just as I
assigned Ctrl-\ to Accept Change and Ctrl-Shift-\ to Reject Change --
can't imagine why any of these three shortcuts aren't built in.)

(Normally a space would not intervene, so "next character" is fine.)

Thank you for your efforts!

On Jul 26, 8:36*pm, Venky62
T wrote:
Sorry about that. You are right. The code I gave you only transposes
superscripts. It does not work with footnote references.

The ^f cannot be used with wildcards. But why would you want a wildcard?
If the aim is to locate all footnotes, then ^f does that. So I have used
the ^f in the Word Search and Replace using code and after selecting the
footnote reference mark, it is just a matter of cutting and pasting it
after the next character.

The code below will work if there are no spaces between the footnote
reference mark and the next character ("." or ","). If there may or may
not be spaces, then the code has to be modified. But it can be done.

Also, this code searches the whole document and transposes all the
footnote reference marks it finds. If some footnote references are in
the correct position and some are not, then this code will have to be
modified further.

I have tested it and it works, but with the above conditions. If you
want it to be more foolproof, please let me know. Or you may work it out
yourself.

Sub TransposeFootnote()
'

'Move to top of document

Selection.HomeKey Unit:=wdStory, Extend:=wdMove

'search whole document

Do Until ActiveDocument.Bookmarks("\Sel").Range.End = _
ActiveDocument.Bookmarks("\EndOfDoc").Range.End

'search for footnote
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
Text = "^f"
Replacement.Text = ""
Forward = True
Wrap = wdFindStop
End With

Selection.Find.Execute

'transpose footnote
If Selection.Find.Found = True Then

With Selection
'cuts the footnote and pastes it after the next character.
'This assumes that there are no spaces between footnote reference
mark and the next character
Cut
Collapse
MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdMove
PasteAndFormat wdFormatOriginalFormatting
'delete the extra space produced by cut and paste
MoveLeft Unit:=wdCharacter, Count:=1
MoveStart Unit:=wdCharacter, Count:=-1
Delete
'move cursor beyond the transposed footnote so as to search for
the next
MoveRight Unit:=wdCharacter, Count:=2

End With
Else
Exit Sub
End If

Loop

End Sub

Peter T. Daniels;492898 Wrote:

Thank you, and did you test it? It doesn't appear to refer to the
special nature of a footnote reference, as opposed to simply dealing
with Superscript format.


Can you point to exactly what the modifications are, so that I can
make just those changes, as opposed to replacing the whole thing and
then maybe having to go back to the earlier version? (I see 7 lines, 2
+ 5, set off near the end.)


[/i][/color]

--
Venky62[/i][/color]