Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spell checking in Visual FoxPro using Word - Word spellcheck dialogue box won't come to foreground 1

Status
Not open for further replies.

wtotten

IS-IT--Management
Apr 10, 2002
181
US
Hi,

I used the sample code from this Tek-tips posting ( about using Word to spellcheck from within a VFP application. If I run it on XP, the Word spellcheck dialog box appears in the foreground. However, if I run it on Windows 7, it doesn't come to the foreground. I have to Alt+Tab over to it to see it. I need some help in getting this resolved please - so it comes to the foreground in Windows 7 (I'm not really worried about Windows 8 or 10 for now).

Thank you,
Bill
 
I would suggest you might like to try FoxSpell.

faq184-5626

I have been using it for years.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
I am wondering what code you use. The first code already has a big problem, if your last use of Word was with maximised window (which is the usual way to work in Word).
The code moving the main Word window out of sight is not working for a maximised Word window and the .WINDOWSTATE=0 trying to set the Window to normal (and thus movable) does not help, even if I add DOEVENTS FORCE.
With word started non maximised last time the code works as is, but it's a too narrow prerequisite.

If you still have problems after you sized the word window smaller than the desktop and closed it, your forms may be set to AlwaysOnTop.

Bye, Olaf.
 
When someone comes to the forum with a problem with a specific product, I'm always reluctant to tell them to go and use a different product instead. I would much rather help them solve the original problem. For all I know, they have already considered the alternative, but decided to go with the original for reasons that I have no way of knowing.

Now, having said that, I do agree that FoxSpell is a very good option. It has pros and cons compared to Word, and for that reason won't be suitable for everyone. But if you do want to consider it, you might find this article helpful: Putting Foxspell Checker to work (but note the date; the information is quite old but I think it's still valid).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
While I agree in general terms Mike, with the advent of the Microsoft 365 offerings where
office isn't really installed on the pc - it's making the use of automation very difficult
to support except in very controlled environments.


Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
Hi everyone who replied,

I already proposed SPS's solution (in fact I installed it for the client and showed it to them). I also proposed FoxSpell. They rejected both of them. The customer wants grammar checking. SPS' solution is a spell checker only.

As far as I understand, FoxSpell is only a spell checker. Does anyone know - is it also a grammar checker?

Olaf, you're right about the Move line of code causing an error. I didn't use the exact code listed there, I used something similar to it. I linked to that post because I noticed that many of the "regulars" here replied to that post so I hoped that one of you had used that code, or something similar, had run into the same problem I'm having and had come up with a solution.

Now that you know my constraints of needing grammar checking, do you have any further suggestions?

Bill

 
Mike,

I couldn't find any grammar checker that's available to use with VFP. Any thoughts on how to bring the Word dialog box to the foreground?

Bill
 
Have you tried using Grammerly? I have not tried it with VFP specifically, but it does integrate with a slew of things.

Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
The main two points you need to gain control over are the main word window positioning and then your own eventual AlwaysOnTop forms.

For example I simply started word, clicked the restore button and thus made the window movable. Then closed word.
Next time also a CreateObject("Word.Application") starts word non maximised and movable. And then the code sample works.
What does not work (either because of Windows 7 or a newer Word version) is the .WINDOWSTATE= 0 line.

Now you got to find out how this would work out also with a maximised Word window, I haven't found out a way to force it to the normal movable state, but I only tried DOEVENTS, maybe try API functions like FindWindow and SetForeGroundWindow or Windows Messages to Word.

Bye, Olaf.
 
Scott24x7 - thanks for the suggestion. Grammarly only works online with browsers. I checked and they don't have an API (I couldn't find one).

Bill
 
Olaf,

You wrote "maybe try API functions like FindWindow and SetForeGroundWindow or Windows Messages to Word.". Do you have any more information and/or suggestions regarding these APIs? I'm not skilled with these types of calls so if you have a suggestion on how to make it work, I would sure appreciate the help. I found a post where someone used one of your recommended APIs and I created another post linking to the post re: the API usage to see if anyone else has a suggestion.

Thank you,
Bill
 
First check out, if what helped me helps you at all. Then we can see how to do it programmatically. We can't be sure my solution is yours, too. Different OS and Word version can play a role here.

Bye, Olaf.
 
Olaf,

I did try what you suggested as far as opening Word, making it "normal" size and then closing it. The "window is maximized" error went away, but there is still the problem with the grammar check/spell check dialog box not coming to the foreground on Windows 7. It doe come to the foreground in Windows XP. Problem is that this app mostly runs on Windows 7 desktops.

Bill
 
Well, Windows 7 is what I used. Do you have different Office versions under XP and Windows 7?

Bye, Olaf.
 
Olaf,

Did you use that exact same code from that thread I mentioned earlier? Did you use it with a control on a form (i.e., from the Click() method of a commandbutton on a form)?

I am using Word 2007 on both the XP and Windows 7 computers. I also tried it using Remote Desktop session on my 2008 R2 server. Same problem.

Bill
 
So maybe it's Word 2010 fixing the problem.

I don't know why you repeat the link to the thread, I already stated I used the code of the question, the original MS code Neil posted and asked how to do that in an SCX, but you did not specify what code you used, there are very many posts with other versions of using the Word spell checker. Please don't just repeatedly point to the thread, tell me what post of that thread you talk about or simply repost your current code, that would be much clearer.

Bye, Olaf.
 
Grammarly only works online with browsers. I checked and they don't have an API (I couldn't find one).

There's a product called Meaning Cloud that appears to offer grammar checking with an API. Their site includes an example in Visual Basic, which suggests that it can also be called from VFP. I know absolutely nothing about it, so this is not a recommendation, but if you want to follow it up, see
And how about Open Office? I think that has a grammar checker, and I believe it also has some sort of API (I have no experience of this).

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top