1. Raymond Longoria
  2. PowerBuilder
  3. Wednesday, 24 February 2021 00:50 AM UTC

I migrated a Powerbuilder application from 8.0 to 2019 R2. The application uses Microsoft Word Spellcheck to check the text in a RTF object. On Windows 7 computers, the spellcheck window appears and gets the focus but on Windows 10 computers the spellcheck does not appear until you click the Word icon in the taskbar. 

Any suggestions on how to get the spellcheck window to get the focus automatically would be greatly appreciated. We are eventually moving away from Microsoft Word so we are open to alternative solutions.

CODE:

oWord = CREATE oleobject
lnvuo_clipboard = CREATE nvuo_clipboard

IF oWord.ConnectToNewObject("word.application") <> 0 THEN return arg_s_somertf

oWord.Visible = FALSE

oDoc = oWord.Documents.Add

oWord.WindowState = wdWindowStateMinimize
oWord.Application.ScreenUpdating = False

lnvuo_clipboard.nvuof_set(arg_l_winhandle, arg_s_somertf)
oWord.Selection.Paste
oDoc.CheckSpelling()

oDoc.Range.copy
lnvuo_clipboard.nvuof_get(arg_l_winhandle, ls_newRTF)

// Clear object memory
DESTROY lnvuo_clipboard

oDoc.saved = TRUE
oWord.Documents.Close (0) // Close file without saving

oWord.Quit() // Exit Word
DESTROY oWord

Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 24 February 2021 15:14 PM UTC
  2. PowerBuilder
  3. # Permalink
1
Votes
Undo

Hi,

Here's a link for a download of my sample application: https://community.appeon.com/index.php/qna/q-a?controller=attachment&task=download&tmpl=component&id=933

I don't think I need "wholestory" in my sample.

You could move the window to a Y postion of -20000 to not show the window, instead of minimizing it.

Please see https://community.appeon.com/index.php/qna/q-a/pb-12-6-error-using-word-2013-as-spell-checker?limitstart=0#reply-5610.


regards

Comment
so what if you create a simple window with a rte control on it, write some text and do a SaveDocument() ? Does it also fail?

regards
  1. Miguel Leeuwe
  2. Monday, 1 March 2021 20:51 PM UTC
Miguel,

I was able to resolve the issue by moving the code to the same window that contains the rte control instead of in a separate rte object. The spellcheck button comes up without a problem.Unfortunately there is still the quick flash of Word after closing the spellcheck window.

Thanks for your help!
  1. Raymond Longoria
  2. Thursday, 4 March 2021 00:19 AM UTC
Yw, yes I can’t get rid of the flashing either.
  1. Miguel Leeuwe
  2. Thursday, 4 March 2021 03:44 AM UTC
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 24 February 2021 02:37 AM UTC
  2. PowerBuilder
  3. # 1
0
Votes
Undo

Hi, Raymond - 

From the code you posted, it appears the WindowState is left minimized and ScreenUpdating is left disabled.

Try setting ScreenUpdating = True and the WindowState to wdWindowStateNormal at the appropriate point in the script.

Regards, John

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.