Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems intercepting Word Events
Message
From
18/05/2009 10:39:22
 
 
To
18/05/2009 08:24:35
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01400371
Message ID:
01400399
Views:
57
My understanding is that VFP looks in the registry for "Word.Application" and maps this to the relevent olb file.

Your understanding is wrong. All versions of Word have the same progid.

m.OlbPath = "Z:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE12\MSWORD.OLB"
DEFINE CLASS WordEvents as Custom
IMPLEMENTS ApplicationEvents2 IN m.OlbPath
This not working is obviously a real pain as it is both Word version and machine specific.


Yes - this is version specific but it is not machine specific unless you are running the source directly and not an executable. If you are running an EXE, this "hard-coded" path is a compile time issue and not a runtime issue. If your client has several different versions of word, you can create a handler for each version they are running, check which version is installed on the machine and instantiate the correct version of the handler. FWIW, this interface is the same in Word XP and Word 2003, so you do not need separate handlers for them. I do not know if the interface changed in Word 2007, but you can check in the object browser to see if you need a separate handler for that.

One alternative to using the hard-coded path to the olb is to use the suid + the version number - for Word 2003, you use this:
{00020905-0000-0000-C000-000000000046}#8.3
Incidentally the Word.Application look up does work for creating an automatable instance of Word:

That is exactly what I would expect to happen. Did you expect something different?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform