ho risolto il problema con una macro che ho creato aiutandomi con la funzione "registra macro" di Word, e devo dire che è abbastanza funzionante e veloce (ma non troppo)
posto qui il codice nel caso a qualcuno potesse servire... (attenzione che la probabilità di bloccarsi è molto alta, quindi conviene salvare ogni qualvolta la macro trova un nuovo carattere da sostituire e formattare...)
Codice:
Sub FindAndReplace()
On Error GoTo SaveAndEnd
Dim BeginDoc As Boolean
BeginDoc = True
Dim Result As VbMsgBoxResult
Result = MsgBox("Le possibilità che Word si blocchi durante l'esecuzione di questa macro sono elevate. Si desidera salvare adesso?", vbYesNoCancel + vbExclamation, "Attenzione!")
If Result = vbYes Then
ThisDocument.Save
ElseIf Result = vbCancel Then
Exit Sub
Else
End If
On Error GoTo SaveAndEnd
For i = 1 To Len(ThisDocument.Content)
Selection.MoveLeft wdCharacter, 2, wdExtend
If BeginDoc = True Then
BeginDoc = False
Else
Selection.MoveStart wdCharacter, 1
End If
Selection.MoveRight Unit:=wdCharacter, Count:=3, Extend:=wdExtend
CheckText "(1)", "1", False
CheckText "(2)", "2", False
CheckText "(3)", "3", False
CheckText "(4)", "4", False
Next i
SaveAndEnd:
ThisDocument.Save
Exit Sub
End Sub
Private Sub CheckText(StringToFind As String, StringToReplace As String, SaveAfter As Boolean)
If Selection.Text = StringToFind Then
Selection.Text = StringToReplace
With Selection.Font
.Name = "Arial"
.Size = 10
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorOliveGreen
.Engrave = False
.Superscript = True
.Subscript = False
.Spacing = 0
.Scaling = 100
.Position = 0
.Kerning = 0
End With
If SaveAfter = True Then ThisDocument.Save
End If
End Sub
E un'altra cosa: il focus deve sempre averlo la finestra di word durante l'operazione seno' Word si bloccherà irrimediabilmente...
(appena verrà avviata la macro per sicurezza chiederà se si vuole continuare l'operazione salvando il documento immediatamente, annullare l'operazione o avviarla senza salvataggi)