PB 9.0.1 App Error R0039 during OLE MS WORD CheckSpelling()

PB 9.0.1 App Error R0039 during OLE MS WORD CheckSpelling()

Post by pleaselogi » Sun, 04 Feb 2007 03:56:43


I've successfully added MS Word spellchecking to my application. It
works exactly as we need it to...

... except with the following problem!

When a user starts spellchecking (in that, I mean MS Word's spell
check dialog box is open) and the user leaves the application, after
about 20 minutes, the app spits out the following error msg:

Error Number 39
Error Text = Error accessing external object property checkspelling at
line 32 in function blah() of object n_blah.

However, if the user mimics the identical process, but does not stop
until the spell check is over, it works 100%.

We are not running any Timer() event or script. This problem also
happens in another application that we've built!

Any suggestions?
 
 
 

PB 9.0.1 App Error R0039 during OLE MS WORD CheckSpelling()

Post by pleaselogi » Sun, 04 Feb 2007 04:02:18


I forgot to mention:

Using OLE to connect to MS Word 2003 SP2

Here's my code:
//This will copy the contents from the source to a word document.
//After the document has been spellchecked, its contents will be given
back
//to the source.

any la_getback
string ls_holdtext
n_cst_conversion lnv_conversion

SetPointer(HourGlass!)

//Perform any pre-spellcheck functionality
gnv_App.EVENT ue_prespellcheck()

IF inv_ole.ConnectToNewObject("word.application") <> 0 THEN
gnv_App.inv_error.of_Message("pfc_systemerror", &
{"CCAIN could not connect to MS Word. Please contact Systems
Support."})
RETURN FAILURE
END IF

inv_ole.Application.Visible = TRUE
inv_ole.Application.WindowState = ii_WordWindowState

inv_ole.Documents.Add
inv_ole.ActiveDocument.Activate
inv_ole.ActiveDocument.Range(0,0).InsertAfter(aa_text)

//Check based on desired style
CHOOSE CASE ii_style
CASE SPELL_GRAMMER
inv_ole.ActiveDocument.CheckGrammar <<<<<<<<<<<<<-----------It's
puking right here, and
CASE SPELLONLY
inv_ole.ActiveDocument.CheckSpelling <<<<<<<<<<<<<-----------It's
puking right here, depending which spellcheck you want to do
END CHOOSE

inv_ole.selection.wholestory()

//get the results of the spellchecker back
la_getback = inv_ole.selection.text

//identify the type of data returned. Data returned may be string,
numeric, or date
//Find out which one it was and then assign it to a string
CHOOSE CASE classname(la_getback)
CASE "boolean"
ls_holdtext = lnv_conversion.of_String(la_getback, 'TRUEFALSE')

CASE "integer", "long", "float", "double", "decimal", "time", "date",
"datetime"
ls_holdtext = string(la_getback)

CASE "string"
ls_holdtext = la_getback

END CHOOSE

IF ls_holdtext <> aa_text THEN aa_text = Mid(ls_holdtext, 1,
len(ls_holdtext) - 1)

inv_ole.ActiveDocument.Saved=TRUE
inv_ole.ActiveDocument.Close
inv_ole.Application.Quit(0, 1, FALSE) //quit, and don't save changes

//Perform any post-spellcheck functionality
gnv_App.EVENT ue_postspellcheck()

RETURN SUCCESS

 
 
 

PB 9.0.1 App Error R0039 during OLE MS WORD CheckSpelling()

Post by pleaselogi » Wed, 07 Feb 2007 22:43:14

ever mind. I figured it out.

To whoever is interested, use inv_ole.SetAutomationTimeout(). This
sets the interval time that Word remains the OLE server to your PB
app.

Thanks

On Feb 2, 1:02 pm, "pleaselogin" < XXXX@XXXXX.COM > wrote: