Ich habe folgendes Skript auf der Microsoft Homepage gefunden. Mit dessen Hilfe gelingt es die Word-Rechtschreibpruefung in Excel anzuwenden.
Private Function SpellIt()
Dim wdApp As Word.Application
Dim wdDoc As Document
Dim rngRange As Range
Dim rngCell As Range
Application.DisplayAlerts = False
Set wdApp = New Word.Application
Set rngRange = Application.Selection
If IsEmpty(rngRange) Then
If ActiveSheet.UsedRange.Count < 650000 Then
Set rngRange = ActiveSheet.UsedRange
Else
MsgBox "Please select a range to spell check or use " _
& "the Excel spelling checker to scan the entire sheet."
Application.DisplayAlerts = True
Exit Function
End If
End If
For Each rngCell In rngRange
If Not IsEmpty(rngCell) Then
Set wdDoc = wdApp.Documents.Add
wdApp.Selection.Text = rngCell
wdApp.Dialogs(wdDialogToolsSpellingAndGrammar).Show
If Len(wdApp.Selection.Text) <> 1 Then
rngCell.Value = wdApp.Selection.Text
Else
wdDoc.Close wdDoNotSaveChanges
wdApp.Quit
Set wdApp = Nothing
Application.DisplayAlerts = True
Exit Function
End If
wdDoc.Close wdDoNotSaveChanges
End If
Next
wdApp.Quit
Set wdApp = Nothing
Application.DisplayAlerts = True
MsgBox "Spelling check complete. Number of cells checked: " _
& rngRange.Count, , "Word 97 Spelling Checker"
End Function
Private Function SpellOptions()
Dim wdApp As New Word.Application
Dim wdDoc As Word.Document
Application.DisplayAlerts = False
Set wdDoc = wdApp.Documents.Add
wdApp.Dialogs(wdDialogToolsOptionsSpellingAndGrammar).Show
wdDoc.Close wdDoNotSaveChanges
wdApp.Quit
Set wdApp = Nothing
Application.DisplayAlerts = True
End Function
Public Function CreateCommandBar()
Dim cmdBar As CommandBar
Dim cmdSpellCheck As CommandBarButton
Dim cmdSpellOptions As CommandBarButton
Dim tmpBar As CommandBar
For Each tmpBar In Application.CommandBars
If tmpBar.Name = "Spelling Checker" Then
Exit Function
End If
Next
Set cmdBar = Application.CommandBars.Add
cmdBar.Name = "Spelling Checker"
With cmdBar.Controls
Set cmdSpellCheck = .Add(msoControlButton)
Set cmdSpellOptions = .Add(msoControlButton)
With cmdSpellCheck
.Style = msoButtonIconAndCaption
.Caption = "Spelling"
.FaceId = 42
.TooltipText = "Word 97 Spelling Checker"
.OnAction = "SpellIt"
End With
With cmdSpellOptions
.Style = msoButtonIconAndCaption
.Caption = "Options"
.FaceId = 162
.TooltipText = "Word 97 Spelling Checker Options"
.OnAction = "SpellOptions"
End With
End With
cmdBar.Visible = True
End Function
Public Function DestroyCommandBar()
On Error Resume Next
Application.CommandBars("Spelling Checker").Delete
End Function
Es funktioniert an sich ja auch ganz toll, wenn man den Text in die Tabelle einfuegt und dann prueft.
Ich will es aber auf Texte in mehreren TextBoxen beziehen und diese auf Rechtschreibfehler pruefen.
Ich habe schon versucht das Skript umzuschreiben leider ohne Erfolg.
Frage, ist es ueberhaupt moeglich? Wenn ja, wie?
Besten Dank im Voraus!!!
Viele Grusse
Andreas