Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running Word 6, 7, or 8???
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00173965
Message ID:
00175716
Views:
32
Here's a modified function - normally it creates and returns a suitable vfpWord object but I've trimmed it for more general use. It's not pretty though - also watch out - MS have changed some of the return values (e.g. from English (UK) to English (British) so you'll have to play around a little). I imagine you'll get "Svensk" for Swedish Word.


This works with Word 6.0, 95 and 97 in both English and Danish (well, alright, I haven't tested 6.0 in Danish). I've not been able to get the OLELocale, etc., working with 6.0 or 95.

Hope it helps.



function makeSqaWord
lparameter wo
local o, s
* given a valid word.basic object, creates and returns
* the appropriate class...

* Word has .appInfo or .progInfo (or whatever) depending on the language
* can't tell until you try and then raise the error...

on error oleErrorHandler()
swutil_iInfo = 0
s = "*"

* fetch the language so we know what we're dealing with...

do while s = "*"
do case
case swutil_iInfo = 0
s = wo.appInfo(16)
case swutil_iInfo = 1
s = wo.progInfo(16)
otherwise
s = ""
endcase
enddo

* now we've got the language, fetch the version using the correct appinfo
* or progInfo or whatever...

local nWordVer
do case
case (s = "English (AUS)") or (s = "English (UK)") ;
or (s = "English (US)")
nWordVer = val(wo.appInfo(2))
if nWordVer < 8
*word 6 or whatever...
else
* word 97...
endif
*messageBox("would create English version")

case (s = "English (British)" ) && probably Word97
* probably word 97...


case (s = "Dansk")
*messageBox("would create DANISH version")
nWordVer = val(wo.appInfo(2))
if nWordVer < 8
* word 6 or whatever...
else
* word 97...
endif

otherwise
*messageBox("Unknown type - FAILED!")
*...
endcase
*on error...restore your error handler here...
return &&...whatever...
endfunc

function oleErrorHandler
swutil_iInfo = swutil_iInfo+1
endfunc
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform