General information
Category:
COM/DCOM and OLE Automation
>>Has anyone figured out how to close the WINWORD.EXE process that an oldboundcontrol object starts when it is assigned a control source?
>>
>>Here is the code I'm using:
>>
>> oform = CREATEOBJECT('form')
>> oform.ADDOBJECT('owordobject','oleboundcontrol')
>> oform.owordobject.CONTROLSOURCE = 'c_parent.contract'
>> oform.owordobject.SAVEAS(lcdir+lcfilename)
>> oform.owordobject.CONTROLSOURCE = ''
>> oform.REMOVEOBJECT('owordobject')
>> oform = ''
>> RELEASE oform
>>
>>REMOVOBJECT() and RELEASE oform do not remove the WINWORD.EXE process from the task manager. I thought maybe setting the CONTROLSOURCE to blank would do it but that didn't work either.
>>
>>HELP!!!!
>>
>>Trish
>
>Trish,
>
>
>WITH oForm.oWordObject
>.ActiveDocument.Close(0)
>.oWordObject.Quit()
>.oWordObject = .NULL.
>ENDWITH
>
>José
Every line produced an error.
This is how I finally got it to work.
oform = CREATEOBJECT('form')
oform.ADDOBJECT('owordobject','oleboundcontrol')
oform.owordobject.CONTROLSOURCE = 'c_parent.contract'
oform.owordobject.doverb(0)
oform.owordobject.SAVEAS(lcdir+lcfilename)
oform.REMOVEOBJECT('owordobject')
oform.destroy && not necessary
oform.release && not necessary
oform = ''
RELEASE oform
You MUST have the DOVERB(0) AFTER assigning the CONTROLSOURCE. If you don't, it won't release WINDWORD.EXE.
THIS IS NOT A PROBLEM UNDER Windows XP. My original source worked fine on XP. It seems to be a WINDOWS 2000 issue. It was happening on SP2 and SP3.
Thanks.
Trish
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only