COMO REVISAR LA ORTOGRAFIA
Publicado por marval (49 intervenciones) el 20/04/2004 10:18:37
Tengo este codigo que he encontrado para revisar la ortografía:
Private Sub Command1_Click()
Dim speller As Object
Dim txt As String
Dim new_txt As String
Dim pos As Integer
On Error GoTo OpenError
Set speller = CreateObject("Word.Basic")
On Error GoTo 0
speller.FileNew
speller.Insert Text1.Text
speller.ToolsSpelling 'Cuadro de ortografía
speller.EditSelectAll
txt = speller.Selection()
speller.FileExit 2
If Right$(txt, 1) = vbCr Then _
txt = Left$(txt, Len(txt) - 1) 'Carácter de retorno de carro
new_txt = ""
pos = InStr(txt, vbCr) 'Primera posición del carácter retorno de carro
Do While pos > 0
new_txt = new_txt & Left$(txt, pos - 1) & vbCrLf 'Retorno carro y avance línea
txt = Right$(txt, Len(txt) - pos) 'Siguiente línea
pos = InStr(txt, vbCr)
Loop
new_txt = new_txt & txt
Text1.Text = new_txt
Exit Sub
OpenError:
MsgBox "Error" & Str$(Error.Number) & _
" opening Word." & vbCrLf & _
Error.Description
End Sub
SI PODEIS EXPLICARME QUE HACE... NECESITO HACERLO EN UN EDITOR CON UN RICHTEXTBOX.
AGRADECERÉ TODO LO QUE ME PUEDA AYUDAR... GRACIAS DE ANTEMANO
Private Sub Command1_Click()
Dim speller As Object
Dim txt As String
Dim new_txt As String
Dim pos As Integer
On Error GoTo OpenError
Set speller = CreateObject("Word.Basic")
On Error GoTo 0
speller.FileNew
speller.Insert Text1.Text
speller.ToolsSpelling 'Cuadro de ortografía
speller.EditSelectAll
txt = speller.Selection()
speller.FileExit 2
If Right$(txt, 1) = vbCr Then _
txt = Left$(txt, Len(txt) - 1) 'Carácter de retorno de carro
new_txt = ""
pos = InStr(txt, vbCr) 'Primera posición del carácter retorno de carro
Do While pos > 0
new_txt = new_txt & Left$(txt, pos - 1) & vbCrLf 'Retorno carro y avance línea
txt = Right$(txt, Len(txt) - pos) 'Siguiente línea
pos = InStr(txt, vbCr)
Loop
new_txt = new_txt & txt
Text1.Text = new_txt
Exit Sub
OpenError:
MsgBox "Error" & Str$(Error.Number) & _
" opening Word." & vbCrLf & _
Error.Description
End Sub
SI PODEIS EXPLICARME QUE HACE... NECESITO HACERLO EN UN EDITOR CON UN RICHTEXTBOX.
AGRADECERÉ TODO LO QUE ME PUEDA AYUDAR... GRACIAS DE ANTEMANO
Valora esta pregunta


0