Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting When a Word Object no longer exists
Message
 
To
06/03/1998 10:40:43
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00082838
Message ID:
00083558
Views:
28
>>>I have a Word 97 (Word.application) object that I have programatically created which opens a file in Word97. How can I have VFP keep running in a loop until the user closes/exits Word97.
>>>
>>>In other words, how can I tell when the Word97 object no longer exists.
>>
>>Hi John,
>>
>>Following function gives information of current Word instance
>>
>>GETOBJECT("", 'word.basic') returns object data type which can be stored in some global method to determine existance of Word Application
>>
>>Get back to me if you still need more information
>>
>>bye
>>jayesh
>Hi Jayesh,
>I couldn't understand how I could use getobject() to check if the app is exited or not. Could you show it in following example ?
>
>oWord = createobject("word.basic")
>with oWord
>  .appshow
>  cDSN = "DSN=Visual FoxPro Tables;UID=;PWD=;"
>  cSourceDb = "SourceDB=C:\Program Files\vfp50\SAMPLES\DATA\Testdata.dbc"
>  cSourceType = ";SourceType=DBC;"
>  cOther = "Exclusive=No;BackgroundFetch=No;Collate=Machine;"
>  cSQLStatement = "SELECT company, contact FROM customer"
>  .InsertDatabase(35,511,0, ;
>		cDSN+cSourceDb+cSourceType+cOther, ;
>		cSQLStatement,,,,,,,1)
>endwith
>* Here I want to check if user exited word
>
>Cetin
Hi

You can check the existance of Word by checking one of the
basic proprety. I have tried following and it works

loword = createobject('word.basic')
?TYPE('loword.Filenew') && will return 'c' data type
*-- Exit word
?TYPE('loword.Filenew') && will return 'u' (undefined)

You can also use GETOBJEct Function somewhere in code where
you allow user to interact with word. i.e.

After executing

oWord = createobject("word.basic")
with oWord
.appshow
cDSN = "DSN=Visual FoxPro Tables;UID=;PWD=;"
cSourceDb = "SourceDB=C:\Program Files\vfp50\SAMPLES\DATA\Testdata.dbc"
cSourceType = ";SourceType=DBC;"
cOther = "Exclusive=No;BackgroundFetch=No;Collate=Machine;"
cSQLStatement = "SELECT company, contact FROM customer"
.InsertDatabase(35,511,0, ;
cDSN+cSourceDb+cSourceType+cOther, ;
cSQLStatement,,,,,,,1)
endwith

*-- Add
IF GETOBJET('word.basic')
*- do something
ELSE
*- Show some message
ENDIF
- Jayesh
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform