Boa tarde
Tenho esta função para corrector ortográfico.
Option Compare Database
Option Explicit
Public Sub SpellCheck(ctlToCheck As Control)
On Error GoTo Handle_Err
Const conProcName As String = "SpellCheck"
Dim ctlActive As Control
If Not IsNull(ctlToCheck) Then
If (ctlToCheck.OldValue <> ctlToCheck.Value) Or _
IsNull(ctlToCheck.OldValue) Then
Set ctlActive = Screen.ActiveControl
With ctlToCheck
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
DoCmd.RunCommand acCmdSpelling
If Not ctlActive Is ctlToCheck Then ctlActive.SetFocus
End If
End If
Exit_Here:
Exit Sub
Handle_Err:
Select Case err.Number
Case 64535
Resume Next
Case Else
End Select
Resume Exit_Here
Resume
End Sub
A função é chamada assim:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Call SpellCheck(SeuCampo)
End Sub
Mas num formulário com campos independentes não funciona.
Alguma ideia
Obrigado
Tenho esta função para corrector ortográfico.
Option Compare Database
Option Explicit
Public Sub SpellCheck(ctlToCheck As Control)
On Error GoTo Handle_Err
Const conProcName As String = "SpellCheck"
Dim ctlActive As Control
If Not IsNull(ctlToCheck) Then
If (ctlToCheck.OldValue <> ctlToCheck.Value) Or _
IsNull(ctlToCheck.OldValue) Then
Set ctlActive = Screen.ActiveControl
With ctlToCheck
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
DoCmd.RunCommand acCmdSpelling
If Not ctlActive Is ctlToCheck Then ctlActive.SetFocus
End If
End If
Exit_Here:
Exit Sub
Handle_Err:
Select Case err.Number
Case 64535
Resume Next
Case Else
End Select
Resume Exit_Here
Resume
End Sub
A função é chamada assim:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Call SpellCheck(SeuCampo)
End Sub
Mas num formulário com campos independentes não funciona.
Alguma ideia
Obrigado