Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to know if MS-Word 2000 or better is available
Message
From
05/06/2007 10:53:44
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01155374
Message ID:
01230599
Views:
27
Re: Excel variables and VFP Thread #937401 Message #941546
Cetin

>I’m working with Adobe InDesign and would like to enable a button if InDesign is installed. It takes a good while if you try to create the object. Is there anyway to check for the existence of the same object without actually trying to open it?
>
>>When a CREATEOBJECT() is executed to automate MS-Word it raises and error. How can I check before hand if MS-Word (better if I can find out if the version is 2000 or above) exists at all. I would like to disable a menu option before hand based on this fact.
>>
>>
>>LOCAL llOK, loApp, lcHandler, loErr, lcMsg
>>llOK = .T.
>>TRY
>>  loApp = CREATEOBJECT( [Word.Application] )
>>CATCH
>>  TEXT TO lcMsg TEXTMERGE NOSHOW PRETEXT 3
>>    It seems that Word is not installed on the computer.
>>    You must have Word installed to continue.
>>  ENDTEXT
>>  MESSAGEBOX( lcMsg, 64 )
>>  llOK = .F.
>>ENDTRY
>>IF llOK
>>  IF INLIST( ALLTRIM( loApp.version ), [9.0], [10.0], [11.0] )
>>  ELSE
>>    TEXT TO lcMsg TEXTMERGE NOSHOW PRETEXT 3
>>      You must have either at least Word 2000 installed
>>      to continue.
>>    ENDTEXT
>>    MESSAGEBOX( lcMsg, 64, [T. K. Plastics] )
>>    llOK = .F.
>>    loApp.quit()
>>  ENDIF
>>ENDIF
>>
>>RETURN llOK
>>
Ç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
Previous
Reply
Map
View

Click here to load this message in the networking platform