But if I place ThisForm.Edit1.Value = _ClipText in another command button. i.e. one command for check and one command for replace the value, it works OK.
Here is "bits and pieces" or a spellcheck routine that now works perfectly. Credit to (Mike) mgagnon and other visfox tek-tips forum members who helped me out with this sometime ago.
Bear in mind this particular code spellchecks a memo field, stores it and returns it to the table. I think was an issue once where the spellcheck routine started but did not save the contents of that memo field when it had finished.
Good luck
KB
PUBLIC oform1
oform1=CREATEOBJECT("form1"
oform1.Show
RETURN
DEFINE CLASS form1 AS form
Height = 350
Width = 600
ShowWindow = 2
AutoCenter = .T.
BorderStyle = 1
Caption = "Word Spell Check"
MaxButton = .F.
MinButton = .F.
Movable = .F.
* Icon="crdfle04.ico"
Name = "Form1"
ADD OBJECT edttexttocheck AS editbox WITH ;
Height = 280, ;
Left = 20, ;
Top = 20, ;
Width = 560, ;
Name = "edtTextToCheck"
ADD OBJECT cmdcheckspelling AS commandbutton WITH ;
Top = 312, ;
Left = 130, ;
Height = 27, ;
Width = 149, ;
Caption = "\<Spell Check", ;
Name = "cmdCheckSpelling"
* Thi has been added as an additional command button
ADD OBJECT cmdsaveafter AS commandbutton WITH ;
Top = 312, ;
Left = 300, ;
Height = 27, ;
Width = 149, ;
Caption = "\<Save & Exit", ;
Name = "cmdsaveafter"
PROCEDURE findword
LOCAL lcPath, lcResult, lcFileName, llRetVal, ;
lcCurDir, lnFileHand, lcWordPath
* *****************************************************************************
* USE YOURTABLE && You Need To Add Your Table Here
* USE TTTD && This Is Mine!
* GO 1 && Which Ever Record You want To Spell Check
* *****************************************************************************
STORE TRIM(QUESTION) TO mquestion && This Is Your Memo Field In Your Table
THIS.edtTextToCheck.VALUE = mquestion && Memo Field
ENDPROC
PROCEDURE cmdcheckspelling.Click
IF TYPE([goWord]) # [O] && Check if you have already instantiated Word
IF !THISFORM.FindWord() && You don't have Word up, so let's locate it.
MESSAGEBOX([Microsoft Word is either not installed or is incorrectly registered.], + ;
0,[Word Start-Up Failed])
RETURN .F.
ENDIF
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 before you can move it)
.MOVE(1000,1000) && Move the window out of view
goWordDoc = .Documents.ADD
ENDWITH
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.