Question : Spell Check solution from ijafferr for Access Field. Spell Check window is sometimes beneath main window

Hi, Jaffer's code (enclosed) is very helpful and generally works well however sometimes the Word Spell check window remains underneath the working window and the PC is virtually 'locked' waiting for an input to the spell window. ALT TAB can bring the spell window to the top, however can u supply a little additional code to the function or whatever to bring the spell check code to the foreground.
Thanks
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
jjafferr:Hey ssblue
Got your email,
What reminded you of me, it must be my comments to your new Sentence Case question ;o)
 
Lets take care of your Spell check:
 
1-
make a new module, call it SpellingCheck
 
2-
Paste the following code in the module
 
Function SpellCheck(CheckWhat)
    
    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
    X.ActiveDocument.Close savechanges:=wdDoNotSaveChanges
    X.Quit
    Set X = Nothing
    
End Function
 
3-
Save the module.
 
4-
In any Form, I will take WeekendScheduling SubForm as an example,
and will use the Field Housekeeping,
In Design view, Right click on Housekeeping and select properties,
go to On Lost Focus and paste the following there,
=SpellCheck([HouseKeeping])
 
5-
Save your Form.
 
Now, everytime you finish writing something in HouseKeeping field, the spell checker will check your spelling and will give you options for corrections.
 
For any Form/Field you want to spell check, on the Lost Focus of the field, paste
=SpellCheck([YourFieldName])
please change YourFieldName to the name of the field where you want to do the spell check,
in my example above,
YourFieldName was replaced with HouseKeeping
 
hope thi helps,
 
jaffer
Open in New Window Select All

Answer : Spell Check solution from ijafferr for Access Field. Spell Check window is sometimes beneath main window

Hi

Nice to know that the code is still in use :)

Try this:
Place this code before calling the spell checker Function

AppActivate "microsoft word"

I have seen a few problems with MS Word acting like this,
if this didn't work, then we can simulate Alt Tab, but we will have to know the process ID of MS Word, which makes it a bit complicated.

jaffer
Random Solutions  
 
programming4us programming4us