问题
I want to check spelling in all labels that I have in a user form in VBA.
I would appreciate it if anyone could help me.
回答1:
Private Sub UserForm_Initialize()
Dim ctrl As Object
For Each ctrl In Me.Controls
If TypeName(ctrl) = "Label" Then
With ctrl
If Not Application.CheckSpelling(.Caption) Then
.ForeColor = vbRed
.BackColor = vbYellow
End If
End With
End If
Next
End Sub
来源:https://stackoverflow.com/questions/38965880/spelling-check-in-user-form-in-vba