Spelling check in user form in VBA

走远了吗. 提交于 2020-01-17 07:20:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!