Code to Auto-Cancel a Dialogue Box

Status
Not open for further replies.

FracinDean

Board Regular
Joined
Jul 11, 2011
Messages
110
Office Version
  1. 365
Platform
  1. Windows
I'm trying to generate word lists that meet certain tests. I would like to use Spellcheck to decide when something is actually a word. I am able to determine if something is a word from the CheckSpelling method return value "TRUE" or "FALSE", but I have not been able to determine how to close the spell check dialogue box from within my code. I don't want the user to have to do anything to close the dialogue box, but rather to have the code do it. I always want to select the "Cancel" option for the dialogue box. I think the issue is how to programmatically respond to a dialogue box when the fact that the dialogue opened has paused the execution of your code. Here is my example code:

Code:
Dim isWord as Boolean, wordToCheck as string
Range("myWord").Select
wordToCheck = Selection.Value
isWord = Selection.CheckSpelling(wordToCheck)
Msgbox ("Result is " & isWord)
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,444
Messages
6,124,893
Members
449,194
Latest member
JayEggleton

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top