J
Joacim
Hi everyone,
I found this great code from Gregy Maxey/Doug Robbins. I didmy 2 col table
and it throws it into Autocorrect in less time than it takes to blink. But
I would like to add a few formatted entries. I realise that is a little more
complex? I did attempt to do true/false but it was over my head).
Any ideas if it can be done easily?
Sub MultiAutoCorrectGenerator()
'Adapted by Greg Maxey from MultiFindAndReplace code
'provided by Doug Robbins
Dim oDoc As Document
Dim i As Integer
Dim Wrong As Range
Dim Right As Range
Set oDoc = ActiveDocument
Selection.Tables(1).Cell(1, 1).Range.Select
Selection.Collapse
For i = 2 To oDoc.Tables(1).Rows.Count
If oDoc.Tables(1).Rows(i).Cells(1).Range.Characters.Count > 1 Then
Set Wrong = oDoc.Tables(1).Cell(i, 1).Range
Wrong.End = Wrong.End - 1
Set Right = oDoc.Tables(1).Cell(i, 2).Range
Right.End = Right.End - 1
AutoCorrect.Entries.Add Name:=Wrong, Value:=Right
End If
Next i
End Sub
I found this great code from Gregy Maxey/Doug Robbins. I didmy 2 col table
and it throws it into Autocorrect in less time than it takes to blink. But
I would like to add a few formatted entries. I realise that is a little more
complex? I did attempt to do true/false but it was over my head).
Any ideas if it can be done easily?
Sub MultiAutoCorrectGenerator()
'Adapted by Greg Maxey from MultiFindAndReplace code
'provided by Doug Robbins
Dim oDoc As Document
Dim i As Integer
Dim Wrong As Range
Dim Right As Range
Set oDoc = ActiveDocument
Selection.Tables(1).Cell(1, 1).Range.Select
Selection.Collapse
For i = 2 To oDoc.Tables(1).Rows.Count
If oDoc.Tables(1).Rows(i).Cells(1).Range.Characters.Count > 1 Then
Set Wrong = oDoc.Tables(1).Cell(i, 1).Range
Wrong.End = Wrong.End - 1
Set Right = oDoc.Tables(1).Cell(i, 2).Range
Right.End = Right.End - 1
AutoCorrect.Entries.Add Name:=Wrong, Value:=Right
End If
Next i
End Sub