Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Word/Excel Automation
Message
 
 
To
17/11/1999 17:18:42
Jim Rieck
Quicken Loans/Rock Financial/Title Sourc
Livonia, Michigan, United States
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00292151
Message ID:
00292203
Views:
18
This was an interesting problem to solve. And that said, I am not sure this is an optimal, but it may be a start.....

In the init of your form, you could have code like this:

set proc to foo.prg additive
oform = thisform
oForm.addobject('oWordDoc','myolecontrol',"word.document")
oForm.oWordDoc.Height = THISFORM.txtFrame.height
oForm.oWordDoc.Width = THISFORM.txtFrame.width
oForm.oWordDoc.Top = THISFORM.txtFrame.top
oForm.oWordDoc.Left = THISFORM.txtFrame.left
oForm.oWordDoc.Visible = .t.
oForm.Show

The foo program is holds a class definition for an olecontrol class. Here is that code:


define class myolecontrol as olecontrol
documentfile = getfile() && point to a word doc, or any other file
enddefine


The documentfile is a read only property, you can set it in the constructor. It is something that is not done all that often, but it does work...



>What would I add to the following code to open a word document? I tried oform.oWordDoc.fileOpen(sys(5) + sys(2003) + "\cquote.doc"), but it doesn't work.
>
>thanks
>
>Jim
>Here's the code:
>oform = thisform
>oForm.addobject('oWordDoc','olecontrol','word.document')
>oForm.oWordDoc.Height = THISFORM.txtFrame.height
>oForm.oWordDoc.Width = THISFORM.txtFrame.width
>oForm.oWordDoc.Top = THISFORM.txtFrame.top
>oForm.oWordDoc.Left = THISFORM.txtFrame.left
>oForm.oWordDoc.Visible = .t.
>oForm.Show
>
>oForm.oWordDoc.DoVerb(0)
>
>IF TYPE("oForm.oWordDoc.object.name") # "C"
> lWord97 = .F.
> oWordRef = GetObject('','word.basic')
>ENDIF
Previous
Reply
Map
View

Click here to load this message in the networking platform