Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Spell checking in Word 2002 (XP)
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Spell checking in Word 2002 (XP)
Miscellaneous
Thread ID:
00619311
Message ID:
00619311
Views:
72
I'm using the code from Microsoft to spell check using MS Word (http://support.microsoft.com/default.aspx?scid=kb;EN-US;q271819) and it works nicely under Word 2000 or earlier (which is admittedly all it claims to do). But it doesn't work for users with Word 2002 (XP).

If Word 2002 is already open (and they *do* have a proper DOC file association), then this condition fails:

DECLARE INTEGER FindExecutable IN shell32 STRING @lcFilename, ;
STRING @lcPath , STRING @lcResult
*!* Determine the file association on .DOC files
IF FindExecutable(@lcFileName, @lcPath, @lcResult) > 32

If Word 2002 is not already open, then the condition above passes (!) but then there is a problem in the next section of code:

PUBLIC goWord, goWordDoc && Public vars for Word and Document1 in Word.
goWord = CREATEOBJECT([WORD.APPLICATION]) && Create Word
WITH goWord
.WINDOWSTATE= 0 && wdWindowStateNormal (needs to be Normal..
.MOVE(1000,1000) && Move the window out of view
goWordDoc = .Documents.ADD
ENDWITH

The line which calls the MOVE method triggers an error (“OLE IDispatch exception code 0 from Microsoft Word: Window is maximized.”) suggesting that the previous line didn’t properly set the WINDOWSTATE.

What can I do to make this work for Word 2002 users? (It boggles the mind that FindExecutable() and .WINDOWSTATE would work differently for the newer version of Word).

In the worst case, how can I test for the version of Word that they are using?

(Using VFP6 if that matters. And yes, I do have FoxSpell but my users would rather use the Word feature and their existing dictionary).

Thanks.

-Bob
Reply
Map
View

Click here to load this message in the networking platform