General information
Category:
ActiveX controls in VFP
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only