Right Click Menu Spell Check - Limit to me.field

dgreen

Member
Local time
Today, 08:58
Joined
Sep 30, 2018
Messages
397
I had a user ask if there was a way to run the spell check on an individual field using a right click event?

I've found the code to run Spell Check using the Set cmbb = cmbRC.Controls.Add(msoControlButton, 12328) (see attached visual) but it's running the check for every field on the continuous form.
Picture1.png

I have other ways to do it (click a button to run against specific fields, BeforeUpdate and AfterUpdate, so I'm curious if this is an option.
 
Last edited:
You're using a built-in command button so I think that's what you can expect as it's the default behaviour. The only thing I can think of is that you'd need a custom menu button with an OnAction event that calls a function to check only the field with the focus, and that's presuming the form is bound because I believe you'd also need to identify the current record. Then you'd have to know how to check the value against the dictionary, which I don't.
 
Hi. Try converting your button code to a function in a Standard Module and then call it from your right click button instead of the built-in spellcheck feature.
 
@ theDBguy Something like this? What's next? When I try and use it, cmbRC and cmbb both = "Nothing" Do I need to bring more code up?
Code:
Public Function SpellCheck()
Dim cmbRC As CommandBar
Dim cmbb As CommandBarButton

    Set cmbb = cmbRC.Controls.Add(msoControlButton, 12328)
           cmbb.caption = "Spell Check"
End Function

And then like this for the RightClickButton?

Code:
Public Sub CreateRightClickBar()

Dim cmbRC As CommandBar
Dim cmbb As CommandBarButton
Dim strBarName As String

strBarName = "FormRightClick"

On Error Resume Next
CommandBars(strBarName).Delete
On Error GoTo 0

Set cmbRC = CommandBars.Add(strBarName, msoBarPopup, False)

Set cmbb = cmbRC.Controls.Add(msoControlButton, 22)
cmbb.caption = "Paste"

Call SpellCheck

Set cmbRC = Nothing
Set cmbb = Nothing
End Sub
 
@ theDBguy Something like this? What's next? When I try and use it, cmbRC and cmbb both = "Nothing" Do I need to bring more code up?
Code:
Public Function SpellCheck()
Dim cmbRC As CommandBar
Dim cmbb As CommandBarButton

    Set cmbb = cmbRC.Controls.Add(msoControlButton, 12328)
           cmbb.caption = "Spell Check"
End Function

And then like this for the RightClickButton?

Code:
Public Sub CreateRightClickBar()

Dim cmbRC As CommandBar
Dim cmbb As CommandBarButton
Dim strBarName As String

strBarName = "FormRightClick"

On Error Resume Next
CommandBars(strBarName).Delete
On Error GoTo 0

Set cmbRC = CommandBars.Add(strBarName, msoBarPopup, False)

Set cmbb = cmbRC.Controls.Add(msoControlButton, 22)
cmbb.caption = "Paste"

Call SpellCheck

Set cmbRC = Nothing
Set cmbb = Nothing
End Sub
Hi. I don't see you using this in your button. You would use it to call your function.

 

Users who are viewing this thread

Back
Top Bottom