Hi
I have the code below that is intended to kick off a word spell check on a MLE field in Visual Age.
It works beautifully except for the fact that the spell checker can only be opened by going to the task manager and click on the application.
Does anybody know how I can get this spell checker to appear without having to go to the task bar.
Thanks in advance
Xabi
| tWordApp tAutoObj tTask tRC tDocs tDocument tText tFlag tOrigText tNewText |
tWordApp := WordAppWrapper createObject. "-Create Word Application wrapper"
tDocs := tWordApp documents: (OleAutomationObject createObject: 'Test').
tDocs := tWordApp documents.
tAutoObj := tDocs invoke: 'Add' withArguments: #().
tDocument := WordDocWrapper createObject. "-Create a temp document to use spell check"
tDocument automationObject: tAutoObj.
"-Position Word application off screen to avoid having document visible..."
tRC := (tDocument automationObject) propertyAt: 'WindowState' put: 0.
tRC := (tDocument automationObject) propertyAt: 'Top' put: -3000.
"-Put the text from the Multi-line edit field into the Word document "
tOrigText := aString.
"-Fix any Cr characters"
"tOrigText := self convertCrToCrLf: tOrigText."
tRC := tDocument content: tOrigText.
"-Invoke spell check on the contents of the document "
tDocument checkGrammar.
tDocument showSpellingErrors: true.
tRC := (tDocument propertyAt: 'content') invoke: 'CheckSpelling'
withArguments: #() returnType: true.
"-Read the contents back and put them in the entryfield with proper LF chars"
tNewText := (tDocument content) propertyAt: 'text'.
"tNewText := self convertCrToCrLf: tNewText."
"-Close the document"
tRC := tDocument close: false
originalFormat: nil
routeDocument: nil.
"-Close MS Word (Do NOT leave it hanging!)"
tRC := tWordApp quit: false
originalFormat: nil
routeDocument: nil.
(self subpartNamed: 'txtNotes') object: tNewText