Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word 2007, mail merge, preview results not working...
Message
From
31/01/2008 08:24:41
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
30/01/2008 15:15:00
Chris Sund
Silhouette Solutions
Utah, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01286995
Message ID:
01287433
Views:
12
>Cetin,
>
>One additional question. Do you have any tricks up your sleeve to see if a user has Word Installed?
>
>Thanks,
>
>Chris

This is the code I have been using:
? _IsClassRegistered('Word.Application')


function _IsClassRegistered
lparameters tcClass
#DEFINE HKEY_CLASSES_ROOT    -2147483648
#DEFINE ERROR_SUCCESS		0	&& OK

DECLARE Integer RegOpenKey IN Win32API ;
	Integer nHKey, String @cSubKey, Integer @nResult

DECLARE Integer RegCloseKey IN Win32API ;
	Integer nHKey

local lnKey
lnKey = 0
llRetVal = ( RegOpenKey(HKEY_CLASSES_ROOT, tcClass, @lnKey) = ERROR_SUCCESS )
if llRetVal
  RegCloseKey(lnKey)
endif
*vfp7
*CLEAR DLLS 'RegOpenKey', 'RegCloseKey'
return llRetVal
endfunc
But beware that just tells Word.Application class is registered and exists. Doesn't guarantee that you can use it (ie: Dell brand computers with preinstalled office application set the security so that you can't instantiate word,excel using automation). A better check is an attempt to createobject() with try..catch or on error.
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
Previous
Reply
Map
View

Click here to load this message in the networking platform