Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting When a Word Object no longer exists
Message
De
10/03/1998 03:25:34
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00082838
Message ID:
00083559
Vues:
25
Snip..
>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
Hi Jayesh,
I want to warn you of two things :
1-With type() you get "U" if the word is exited. If not exited the code would continue to execute and "oWord.filenewdefault" would cause to open a new file (surrounding with a "do while" you would just get the system to its knee).
2-Getobject() cannot be used as "if getobject()", it returns an object type. Besides getobject("","word.basic") wouldn't fail and return an object whether a word object exists or not (always .t. if applicable to "if getobject").
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform