View Single Post
  #3   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

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

On Jul 26, 9:33*am, Venky62
T wrote:
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

Peter T. Daniels;492888 Wrote:

(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!)