troubleshooting Question

MS Access Text Box Spell Check

Avatar of MDauphinais1
MDauphinais1 asked on
Microsoft Access
6 Comments1 Solution909 ViewsLast Modified:
I want to perform spell check on a specific text box on command click. I found this question which gave me the answer:
https://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_20907475.html

So I have this code:

    Dim X As Object
    CheckWhat.SetFocus
    Set X = CreateObject("Word.Application")
    X.Visible = False
    X.Documents.Add
    X.Selection.Text = CheckWhat.Text
    X.ActiveDocument.CheckSpelling
    CheckWhat.Text = X.Selection.Text
    MsgBox "Spell check is complete.", vbOKOnly, "Spell Check Complete"
    X.ActiveDocument.Close savechanges:=wdDoNotSaveChanges
    X.Quit
    Set X = Nothing

Which works great. Except, if the user clicks Cancel on the spell check window it dumps into word showing the text from the text box. How can I prevent this? I want Cancel to just cancel, do nothing else, show nothing else.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros