Wildcard "special" searches

P

Peter T. Daniels

(Word2007)

My authors are European, so they love to put their periods and commas
after their footnote references, but that's not how we Americans do
it. I'm getting tired of manually moving the punctuation around (and
the Transpose macro results in a superscript period before the
footnote reference, which isn't an improvement).

Word tells me that I cannot use both ^f and Wildcards in a
(Find-)Replace, so how can I automate this procedure? (Is it possible
to modify the Transpose macro to not affect the Superscript status of
the characters involved, since it's unlikely in the extreme that a
typo would involve superscripting!)

(Here's the text of the macro that was provided here years ago; it was
modified from the original because it was taking longer and longer to
work as a file got bigger, so a checking operation was removed.)

Sub Transpose()
Dim oRng As Range
Dim sText As String
Dim Msg1 As String
Dim Msg2 As String
Dim Msg3 As String
Dim MsgTitle As String
Msg1 = "You must place the cursor between " & _
"the 2 characters to be transposed!"
Msg2 = "There are no characters to transpose?"
Msg3 = "There is no document open!"
MsgTitle = "Transpose Characters"
On Error GoTo ErrorHandler
Set oRng = Selection.Range
Select Case Len(oRng)
Case Is = 0
If oRng.Start = oRng.Paragraphs(1).Range.Start Then
MsgBox Msg1, vbCritical, MsgTitle
Exit Sub
End If
If oRng.End = oRng.Paragraphs(1).Range.End - 1 Then
MsgBox Msg1, vbCritical, MsgTitle
Exit Sub
End If
With oRng
.Start = .Start - 1
.End = .End + 1
.Select
sText = .Text
End With
Case Is = 1
MsgBox Msg1, vbCritical, MsgTitle
Exit Sub
Case Is = 2
sText = Selection.Range.Text
Case Else
MsgBox Msg1, vbCritical, MsgTitle
Exit Sub
End Select
With Selection
If .Range.Characters(1).Case = 1 _
And .Range.Characters(2).Case = 0 Then
.TypeText UCase(Mid(sText, 2, 1)) & _
LCase(Mid(sText, 1, 1))
Else
.TypeText Mid(sText, 2, 1) & _
Mid(sText, 1, 1)
End If
.MoveLeft wdCharacter
End With
End
ErrorHandler:
If Err.Number = 4248 Then
MsgBox Msg3, vbCritical, MsgTitle
End If
End Sub
 
V

Venky62

I modified the code slightly. This should solve your problem.

Sub Transpose()
Dim oRng As Range
Dim sText As String
Dim Msg1 As String
Dim Msg2 As String
Dim Msg3 As String
Dim MsgTitle As String
Msg1 = "You must place the cursor between " & _
"the 2 characters to be transposed!"
Msg2 = "There are no characters to transpose?"
Msg3 = "There is no document open!"
MsgTitle = "Transpose Characters"
On Error GoTo ErrorHandler
Set oRng = Selection.Range
Select Case Len(oRng)
Case Is = 0
If oRng.Start = oRng.Paragraphs(1).Range.Start Then
MsgBox Msg1, vbCritical, MsgTitle
Exit Sub
End If
If oRng.End = oRng.Paragraphs(1).Range.End - 1 Then
MsgBox Msg1, vbCritical, MsgTitle
Exit Sub
End If
With oRng
.Start = .Start - 1
.End = .End + 1
.Select
sText = .Text
End With
Case Is = 1
MsgBox Msg1, vbCritical, MsgTitle
Exit Sub
Case Is = 2
sText = Selection.Range.Text
Case Else
MsgBox Msg1, vbCritical, MsgTitle
Exit Sub
End Select
With Selection
If .Range.Characters(1).Case = 1 _
And .Range.Characters(2).Case = 0 Then
.TypeText UCase(Mid(sText, 2, 1)) & _
LCase(Mid(sText, 1, 1))

ElseIf .Range.Characters(1).Font.Superscript = True _
And .Range.Characters(2).Font.Superscript = False Then

.TypeText UCase(Mid(sText, 2, 1)) & _
LCase(Mid(sText, 1, 1))
Selection.MoveStart Unit:=wdCharacter, Count:=-2
Selection.Characters(1).Font.Superscript = False
Selection.Characters(2).Font.Superscript = True

Else
.TypeText Mid(sText, 2, 1) & _
Mid(sText, 1, 1)
End If
.MoveLeft wdCharacter
End With
End
ErrorHandler:
If Err.Number = 4248 Then
MsgBox Msg3, vbCritical, MsgTitle
End If
End Sub
 
P

Peter T. Daniels

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.)
 
V

Venky62

Sorry about that. You are right. The code I gave you only transpose
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 use
the ^f in the Word Search and Replace using code and after selecting th
footnote reference mark, it is just a matter of cutting and pasting i
after the next character.

The code below will work if there are no spaces between the footnot
reference mark and the next character ("." or ","). If there may or ma
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 th
footnote reference marks it finds. If some footnote references are i
the correct position and some are not, then this code will have to b
modified further.

I have tested it and it works, but with the above conditions. If yo
want it to be more foolproof, please let me know. Or you may work it ou
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 referenc
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 fo
the next
.MoveRight Unit:=wdCharacter, Count:=2

End With
Else
Exit Sub
End If

Loop

End Sub
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]
[/i][/color[/QUOTE]
 
P

Peter T. Daniels

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!

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
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]
[/QUOTE]
[/QUOTE]
 
V

Venky62

Okay. Here is the modified code. This macro can be assigned to an
shortcut key combination and used. Place the cursor anywhere before th
first footnote reference you want to transpose and hit the shortcu
keys. It will transpose the footnote reference. Hit the shortcut ke
again and it will transpose the next footnote reference in your text
And so on. It will change only one footnote at a time.

As suggested by you, this macro does not cut and paste the footnot
reference but cuts and pastes the first character after the referenc
which is not a space. So it doesn't matter if the character is a "." o
"," or anything else. This macro will work even if there are space
between the footnote reference and the next character. If there ar
extra spaces, they will moved beyond the footnote reference.



Sub TransposeFootnote2()

'declare variables
Dim intpos1, intpos2 As Integer

'search for footnote
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting

With Selection.Find

.Text = "^f"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = False

End With

Selection.Find.Execute

If Selection.Find.Found = True Then

'assign the character position of selection to variable
intpos1 = Selection.Characters.Last. _
Information(wdFirstCharacterColumnNumber)


'search for any character except space
Selection.Collapse wdCollapseEnd
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting

With Selection.Find

.Text = "[!"" ""]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True

End With

Selection.Find.Execute

'assign selected character's position to variable
intpos2 = Selection.Characters.Last. _
Information(wdFirstCharacterColumnNumber)

'transpose footnote
With Selection

'cuts the character next to footnote and pastes it befor
the footnote reference.
'This will work even if there are spaces between footnot
reference mark and the next character
.Cut
.Collapse
.MoveLeft Unit:=wdCharacter, Count:=intpos2 - intpos1
.PasteAndFormat wdFormatOriginalFormatting
'move curson beyond the transposed footnote so as to searc
for the next
.MoveRight Unit:=wdCharacter, Count:=2

End With
Else
Exit Sub
End If

End Sub
 
P

Peter T. Daniels

Great! Thanks! I'll try it shortly.

(I don't suppose you can handle XML? The Bibliography Tool has some
pretty annoying mistakes in it, and using Yves Dhondt's page I've been
able to correct only one of them.)

Okay. Here is the modified code. This macro can be assigned to any
shortcut key combination and used. Place the cursor anywhere before the
first footnote reference you want to transpose and hit the shortcut
keys. It will transpose the footnote reference. Hit the shortcut key
again and it will transpose the next footnote reference in your text.
And so on. It will change only one footnote at a time.

As suggested by you, this macro does not cut and paste the footnote
reference but cuts and pastes the first character after the reference
which is not a space. So it doesn't matter if the character is a "." or
"," or anything else. This macro will work even if there are spaces
between the footnote reference and the next character. If there are
extra spaces, they will moved beyond the footnote reference.

Sub TransposeFootnote2()

'declare variables
Dim intpos1, intpos2 As Integer

'search for footnote
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting

With Selection.Find

Text = "^f"
Replacement.Text = ""
Forward = True
Wrap = wdFindStop
MatchWildcards = False

End With

Selection.Find.Execute

If Selection.Find.Found = True Then

'assign the character position of selection to variable
intpos1 = Selection.Characters.Last. _
Information(wdFirstCharacterColumnNumber)

'search for any character except space
Selection.Collapse wdCollapseEnd
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting

With Selection.Find

Text = "[!"" ""]"
Replacement.Text = ""
Forward = True
Wrap = wdFindStop
MatchWildcards = True

End With

Selection.Find.Execute

'assign selected character's position to variable
intpos2 = Selection.Characters.Last. _
Information(wdFirstCharacterColumnNumber)

'transpose footnote
With Selection

'cuts the character next to footnote and pastes it before
the footnote reference.
'This will work even if there are spaces between footnote
reference mark and the next character
Cut
Collapse
MoveLeft Unit:=wdCharacter, Count:=intpos2 - intpos1
PasteAndFormat wdFormatOriginalFormatting
'move curson beyond the transposed footnote so as to search
for the next
MoveRight Unit:=wdCharacter, Count:=2

End With
Else
Exit Sub
End If

End Sub

Peter T. Daniels;492901 Wrote:




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!
 
P

Peter T. Daniels

I'm afraid it doesn't work ... I put an icon for it on my QAT and when I clicked it, it immediately opened the macro listing with the line "Cut" highlighted, apparently claiming that it didn't tell it what to Cut.

(I had to use the icon because I assigned Crtl-Shift-T to the macro but when I tried that in my text, it seemed to think I wanted to apply a digital signature, or something like that.)

(Any possibility that, in the fixing, you could make it work not by searching for the next footnote, but simply by placing the cursor between the footnote reference and the following character, the things that need to be transposed?)

Thank you!

[I have just been forced back into New Google Groups again, and it is now insisting on adding a blank line after every quoted line.]

Okay. Here is the modified code. This macro can be assigned to any

shortcut key combination and used. Place the cursor anywhere before the

first footnote reference you want to transpose and hit the shortcut

keys. It will transpose the footnote reference. Hit the shortcut key

again and it will transpose the next footnote reference in your text.

And so on. It will change only one footnote at a time.



As suggested by you, this macro does not cut and paste the footnote

reference but cuts and pastes the first character after the reference

which is not a space. So it doesn't matter if the character is a "." or

"," or anything else. This macro will work even if there are spaces

between the footnote reference and the next character. If there are

extra spaces, they will moved beyond the footnote reference.







Sub TransposeFootnote2()



'declare variables

Dim intpos1, intpos2 As Integer



'search for footnote

Selection.Find.ClearFormatting

Selection.Find.Replacement.ClearFormatting



With Selection.Find



.Text = "^f"

.Replacement.Text = ""

.Forward = True

.Wrap = wdFindStop

.MatchWildcards = False



End With



Selection.Find.Execute



If Selection.Find.Found = True Then



'assign the character position of selection to variable

intpos1 = Selection.Characters.Last. _

Information(wdFirstCharacterColumnNumber)





'search for any character except space

Selection.Collapse wdCollapseEnd

Selection.Find.ClearFormatting

Selection.Find.Replacement.ClearFormatting



With Selection.Find



.Text = "[!"" ""]"

.Replacement.Text = ""

.Forward = True

.Wrap = wdFindStop

.MatchWildcards = True



End With



Selection.Find.Execute



'assign selected character's position to variable

intpos2 = Selection.Characters.Last. _

Information(wdFirstCharacterColumnNumber)



'transpose footnote

With Selection



'cuts the character next to footnote and pastes it before

the footnote reference.

'This will work even if there are spaces between footnote

reference mark and the next character

.Cut

.Collapse

.MoveLeft Unit:=wdCharacter, Count:=intpos2 - intpos1

.PasteAndFormat wdFormatOriginalFormatting

'move curson beyond the transposed footnote so as to search

for the next

.MoveRight Unit:=wdCharacter, Count:=2



End With

Else

Exit Sub

End If



End Sub




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


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!
 
V

Venky62

Where are you placing the cursor ? Please try the macro with the curso
anywhere on the line where the footnote reference is located but befor
the footnote reference. It should work.

Please let me know if it doesn't. If not, I will code for placing th
cursor between the footnote reference and the next character. If you ca
get this macro to work, it should be even more convenient for you.
 
P

Peter T. Daniels

Where are you placing the cursor ? Please try the macro with the cursor
anywhere on the line where the footnote reference is located but before
the footnote reference. It should work.

I placed the cursor a few characters before the footnote reference, on
the same line.

I just tried it again, and the Visual Basic window opened, with the
line "Cut" highlighted and a little box reading "Compile error: Sub or
Function not defined."
Please let me know if it doesn't. If not, I will code for placing the
cursor between the footnote reference and the next character. If you can
get this macro to work, it should be even more convenient for you.

Indeed.
 
V

Venky62

I can't figure it out. Maybe something was left out while copying m
code? Is there a period before the cut statement? Like ".cut" ?

Could you upload your document so that I could see where the error i
creeping in?
 
P

Peter T. Daniels

I can't figure it out. Maybe something was left out while copying my
code? Is there a period before the cut statement? Like ".cut" ?

Nope. It's directly below two lines in green.
Could you upload your document so that I could see where the error is
creeping in?

You want me to upload my normal.dotm template somewhere? Where?

I installed the macro simply by copying your text from the newsgroup
to the clipboard, then to a Notepad file; then copied it from the
Notepad file to the template (following Greg Mayor's instructions,
which have worked all the times people have posted useful macros here
before).
 
V

Venky62

Okay, rather than your sending the file, I am sending a txt file wit
the code that I have tested again several times, and it has worked ever
time. Hopefully, this will work now.
On Jul 29, 10:48*am, Venky62
(e-mail address removed) wrote:-
I can't figure it out. Maybe something was left out while copying my
code? Is there a period before the cut statement? Like ".cut" ?-

Nope. It's directly below two lines in green.
-
Could you upload your document so that I could see where the error is
creeping in?-

You want me to upload my normal.dotm template somewhere? Where?

I installed the macro simply by copying your text from the newsgroup
to the clipboard, then to a Notepad file; then copied it from the
Notepad file to the template (following Greg Mayor's instructions,
which have worked all the times people have posted useful macros here
before).
-
Peter T. Daniels;492930 Wrote:




-
On Jul 28, 11:19*pm, Venky62
(e-mail address removed) wrote:-
Where are you placing the cursor ? Please try the macro with the
cursor
anywhere on the line where the footnote reference is located but
before
the footnote reference. It should work.--
-
I placed the cursor a few characters before the footnote reference
on
the same line.-
-
I just tried it again, and the Visual Basic window opened, with the
line "Cut" highlighted and a little box reading "Compile error: Su
or
Function not defined."
-
Please let me know if it doesn't. If not, I will code for placing the
cursor between the footnote reference and the next character. If you
can
get this macro to work, it should be even more convenient for you.--
-
Indeed.-

+-------------------------------------------------------------------
|Filename: TransposeFootnote.txt
|Download: http://www.wordbanter.com/attachment.php?attachmentid=134
+-------------------------------------------------------------------
 
P

Peter T. Daniels

It works. Thank you. (I compared the two texts -- the main difference
is that you added periods to start a number of lines.)

But not when the cursor is placed between note and following
character, only when it precedes a note.

And Ctrl-Shift-T still brings up a box saying that if I want to add a
digital signature, blah-di-blah-di-blah. (I've never had trouble
assigning a shortcut before! The default assignment for Ctrl-Shift-T
is "Unhang," something I have no use for, not "digital signature"!)

Maybe Ctrl-Alt-T will do it ...
 
P

Peter T. Daniels

And Ctrl-Shift-T still brings up a box saying that if I want to add a
digital signature, blah-di-blah-di-blah. (I've never had trouble
assigning a shortcut before! The default assignment for Ctrl-Shift-T
is "Unhang," something I have no use for, not "digital signature"!)

Maybe Ctrl-Alt-T will do it ...

D'oh! I failed to notice that when you click "Customize" to add a
shortcut, it doesn't open to the item that's selected in the list
above, but to the first item in the first list of commands, viz.,
AddDigitalSignature!

And when I tested the new shortcut, I learned that if the period is
already before the next footnote, it'll grab the first letter of the
next sentence. Not really ideal. Takes two Undo's to set it right.
 
V

Venky62

Okay. That means your document can have a mixture or correctly place
footnotes and incorrect ones. Also, there may be footnotes in the middl
of a sentence, not only at the end.

This code takes care of that. It searches for a footnote and asks if yo
want it to be transposed. If you click "Yes" then it will do so, else i
will move on. Once it reaches end of document, it will ask you if yo
would like to do the search again from the beginning of document. If yo
say "Yes", then it will take you to the beginning and you can star
again; if "No" then it does nothing.

If you still want to do it by placing the cursor between the footnot
ref. and the next character, that can be done too. But this is mor
useful.
On Jul 30, 3:19*pm, "Peter T. Daniels" (e-mail address removed) wrote:
-
And Ctrl-Shift-T still brings up a box saying that if I want to add a
digital signature, blah-di-blah-di-blah. (I've never had trouble
assigning a shortcut before! The default assignment for Ctrl-Shift-T
is "Unhang," something I have no use for, not "digital signature"!)

Maybe Ctrl-Alt-T will do it ...-

D'oh! I failed to notice that when you click "Customize" to add a
shortcut, it doesn't open to the item that's selected in the list
above, but to the first item in the first list of commands, viz.,
AddDigitalSignature!

And when I tested the new shortcut, I learned that if the period is
already before the next footnote, it'll grab the first letter of the
next sentence. Not really ideal. Takes two Undo's to set it right

+-------------------------------------------------------------------
|Filename: TransposeFootnote2.txt
|Download: http://www.wordbanter.com/attachment.php?attachmentid=135
+-------------------------------------------------------------------
 
P

Peter T. Daniels

Why do you want to make it constantly _more_ complicated? I asked for
a button to do one thing (a "transpose" function that works when a
footnote reference is involved) and you've given it a multitude of
functions whose utility escapes me.

It didn't occur to me to ask about this earlier (because I hate
endnotes) -- I don't suppose this will work on endnote references as
well? (Not really a problem, because if any author had for some reason
used endnotes instead of footnotes, I'd simply use Convert to fix
them, and then when done Convert them back. A problem might arise,
though, in the rare event that a document has both footnotes and
endnotes.)

Okay. That means your document can have a mixture or correctly placed
footnotes and incorrect ones.

That would be its state when editing was partly finished.
Also, there may be footnotes in the middle
of a sentence, not only at the end.

If there's a comma after it (an individual item in a list is
footnoted, say), then it needs to be changed; if there isn't (a note
on the subject of a sentence that would be inappropriate at the end of
the sentence, for instance), then the question would not even arise.
This code takes care of that. It searches for a footnote and asks if you
want it to be transposed. If you click "Yes" then it will do so, else it
will move on. Once it reaches end of document, it will ask you if you
would like to do the search again from the beginning of document. If you
say "Yes", then it will take you to the beginning and you can start
again; if "No" then it does nothing.

That sounds like at least as much, if not more, work than no macro at
all. The point is to _simplify_ editing, not to add complications.
If you still want to do it by placing the cursor between the footnote
ref. and the next character, that can be done too. But this is more
useful.

I suspect you've never been a copyeditor ...
 
V

Venky62

Have you even tried it? Or are you feeling it is more complicated? Sinc
you have so many different scenarios, footnote before character, afte
character, and none, the only way to deal with all of them is to giv
you the choice whether to transpose a footnote or not. I don't see ho
that is more complicated than hunting each footnote in the text, placin
the cursor exactly between the 2 characters and then running the macro
So try it out and see. Of course, if you have only one footnote t
transpose in a whole document, then this may be more work. But then yo
may as well do it manually. Why request a macro?

Why do you want to make it constantly _more_ complicated? I asked for
a button to do one thing (a "transpose" function that works when a
footnote reference is involved) and you've given it a multitude of
functions whose utility escapes me.

It didn't occur to me to ask about this earlier (because I hate
endnotes) -- I don't suppose this will work on endnote references as
well? (Not really a problem, because if any author had for some reason
used endnotes instead of footnotes, I'd simply use Convert to fix
them, and then when done Convert them back. A problem might arise,
though, in the rare event that a document has both footnotes and
endnotes.)

On Jul 30, 8:07*pm, Venky62 (e-mail address removed) wrote:-
Okay. That means your document can have a mixture or correctly placed
footnotes and incorrect ones.-

That would be its state when editing was partly finished.
-
Also, there may be footnotes in the middle
of a sentence, not only at the end.-

If there's a comma after it (an individual item in a list is
footnoted, say), then it needs to be changed; if there isn't (a note
on the subject of a sentence that would be inappropriate at the end of
the sentence, for instance), then the question would not even arise.
-
This code takes care of that. It searches for a footnote and asks i
you
want it to be transposed. If you click "Yes" then it will do so, els
it
will move on. Once it reaches end of document, it will ask you if you
would like to do the search again from the beginning of document. I
you
say "Yes", then it will take you to the beginning and you can start
again; if "No" then it does nothing.-

That sounds like at least as much, if not more, work than no macro at
all. The point is to _simplify_ editing, not to add complications.
-
If you still want to do it by placing the cursor between the footnote
ref. and the next character, that can be done too. But this is more
useful.-

I suspect you've never been a copyeditor ...
--
On Jul 30, 3:19*pm, "Peter T. Daniels" (e-mail address removed) wrote:
-
And when I tested the new shortcut, I learned that if the period is
already before the next footnote, it'll grab the first letter of the
next sentence. Not really ideal. Takes two Undo's to set it right.-

+-------------------------------------------------------------------+
|Filename: TransposeFootnote2.txt * * * * * * * * * * * * * * * * * |
|Download:http://www.wordbanter.com/attachment.php?attachmentid=135|
+-------------------------------------------------------------------+

+-------------------------------------------------------------------
+-------------------------------------------------------------------
 
P

Peter T. Daniels

As I said, you've clearly never done copyediting. I don't "hunt" for
footnotes so as to get all the punctuation of them right, and then go
back and do some other task (though I imagine a computer scientist
could suppose that's a practical way of proceeding).

I'm reading the entire document, beginning to end, fixing everything
as I come to it, and that includes footnote placement; that's why it
makes sense to have a Transpose command for this one special case that
works just like the one that fixes ordinary tpyos.

BTW I had a series of items ending with parenthesis-note-comma, and
the macro flipped the comma and note properly, but inserted a space
before the comma (it doesn't do that with ordinary letters). I suppose
that has to do with Word's attempt to understand when to supply spaces
when moving a "word" (something selected by a double-click) vs. a
series of letters (something selected by dragging).

Have you even tried it? Or are you feeling it is more complicated? Since

I read your description.
you have so many different scenarios, footnote before character, after
character, and none,

There's only one relevant scenario: when I put the cursor between two
characters and want them transposed. It's only a quirk of Word that
causes the older macro not to work with note references.
the only way to deal with all of them is to give
you the choice whether to transpose a footnote or not. I don't see how
that is more complicated than hunting each footnote in the text, placing
the cursor exactly between the 2 characters and then running the macro.
So try it out and see. Of course, if you have only one footnote to
transpose in a whole document, then this may be more work. But then you
may as well do it manually. Why request a macro?

The current article I'm doing has 130 notes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top