Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word Auto Expertise needed
Message
 
To
15/04/1999 17:35:05
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00208789
Message ID:
00208909
Views:
26
>Ok,
>
>Here is what I want to happen
>
>User clicks button, word opens - doc is created using data from current record - formatted, etc.
>
>So far - fine - I'm getting a good grasp on Word automation and can do the above with no problem. Now .. here is the tricky part.
>
>if user saves Word doc IN WORD - I would like VFP to somehow "know" this and do an APPEND GENERAL LINK into the table. If they close Word doc without saving, then of course, nothing happens in VFP.
>
>ideas?
>
>TIA,
>Ken


OK,

I tried this with Word in a General field with no luck whatsoever - in Access you have an OLE_UPDATED event which returns a code based upon the user's action with the OLE object. Unfortunately, this doesn't exist in VFP (at least in 5.0 - maybe it does in 6: anybody?)

I solved this (following advice here on the UT) by storing the Word file in a Memo Binary field and spawning Word when I needed it, having saved / loaded the file to disc. Once you get used to this approach, it is a lot more flexible than the General field version.

Also, there is a bug in the OLE control used with Word: the page size is reset to Custom (approximately the size of the control on your form, e.g. 4 inches) - again, this may have been fixed in VFP 6: anybody?

If you decide to use the Memo field method, let me know: I have code that handles this for Word 6/95 and 97 (they behave differently from each other and on different speed machines). Cetin Bastoz (forgive me if I've spelled it wrong, Cetin) has also posted code here for Word 97 - do a search for it.

I would also strongly advise encapsulating the calls to Word in a class of your own rather than embedding OLE calls directly into your code: that way you can protect yourself from later changes in the Word OLE Automation model further down the line (q.v. Word Basic in 6.0/95 and VBA in 97), handle mulit-lingual versions and possibly other word-processors, should you need to.

Hope this helps.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform