Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
? OLE to MS Word from General Field in VFP 3.0 ?
Message
De
01/07/1996 16:14:22
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00003066
Message ID:
00003278
Vues:
29
>I have a form with a general field that should be
>linked to a seprate MS Word document for each
>record. When I use the OLE Containor control, I
>can link to Word, but not to the General Field.
>WHen I use the OLE Bound control, I can link to
>the General field, but not to word (the OLECLASS
>property is read only). This shouldn't be that
>difficult, what am I doing wrong ? . If I need to
>use CreateObject, why are OLE controls even in the
>toolbar. Please E-mail if you can help, thanks
>
>75364.206@Compuserve.com

Warren,

This isn't that difficult, but from what I have learned from working with OLE and Word it is a bit tricky. The first thing that I did is Create an ole link to Word when I start my form. I create a hidden instance using the following lines:

LOCAL loDocLink
PUBLIC goWordLink

loDocLink = GETOBJECT('','Word.Document.6')
goWordLink = loDocLink.Application.WordBasic

When you open the linked document using "DoVerb" or double clicking on the control, you can use goWordLink to control the behavior of Word.

The purpose I have found for using the OleBoundControl is so you can issue DoVerb and the linked document will open in Word. Otherwise, you have to issue MODIFY GENERAL and then Stuff the keyboard with the appropriate key strokes to open the document in word. Executing a MODIFY GENERAL command only displays the General field into its own window. You still have to tell FoxPro to open the Document.

In the DESTROY of the Form. I check to see if the user closed the Word application. If not I close any open Word files, the application, and Release the goWordLink object.

Now, I have a question for you. In your experience have you found out how to get the name of the linked document programatically without having to actually open the linked document. I know you can do it from the FoxPro menu, but I want to do it behind the scenes.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform