>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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement