Gruppe
Allgemein
Bereich
Liste
Thema
Hinzufügen von Begriffen zur AutoKorrektur-Liste
Problem
Wie kann ich eine Tabelle mit Begriffen zur AutoKorrekturliste hinzufügen bzw. daraus entfernen?
Lösung
Geben Sie den nachfolgenden Code in ein Standardmodul ein und weisen Sie ihn einer Schaltfläche zu.
StandardModule: basMain
Sub AddAutocorrect()
Dim iRow As Integer
Dim sWas As String, sWomit As String
iRow = 1
Do Until IsEmpty(Cells(iRow, 1))
sWas = Cells(iRow, 1)
sWomit = Cells(iRow, 2)
Application.AutoCorrect.AddReplacement _
what:=sWas, Replacement:=sWomit
iRow = iRow + 1
Loop
End Sub
Sub ResetAutocorrect()
Dim iRow As Integer
Dim sWas As String
On Error GoTo ERRORHANDLER
iRow = 1
Do Until IsEmpty(Cells(iRow, 1))
sWas = Cells(iRow, 1)
Application.AutoCorrect.DeleteReplacement _
what:=sWas
iRow = iRow + 1
Loop
Exit Sub
ERRORHANDLER:
MsgBox prompt:="Listeneintrag existiert nicht!"
End Sub