Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WORD.BASIC and OLE Bound Control
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00019605
Message ID:
00019875
Views:
37
>>>I am having difficulties with OLE automation and MS Word.
>>>
>>>I know that in order to access any of the Word functions you have to create the OLE object as Word.Basic and not Word.Document.6. However how do you force the type to be Word.Basic on already existing objects?
>>>
>>>For example, I did the following:
>>>
>>>APPEND GENERAL worddoc FROM junk.doc CLASS "Word.Basic"
>>>oForm = CREATEOBJ( "FORM" )
>>>oForm.ADDOBJECT( "OLEWord", "OLEBOUNDCONTROL" )
>>>oForm.OLEWord.ControlSource = "DATABASE.worddoc"
>>>
>>>I've tried the append with and w/out the quotes. Apparently the system cannot open a document as type word.basic, however I don't know how you can "FileOpen" from a database file w/out having to create a temp file and reappend the file upon completion of the task
>>>
>>You are mixing metaphors here if you will. OLE bound control is one thing and OLE automation is another. If all you want to do is print, you don't need the OLE bound control at all.
>>
>>oform=createobj('word.basic')
>>
>>then open the file and then print it. See OLE automation examples for word at www.microsoft.com/oledev/oleauto
>
>
>I want to use OLE Automation to manipulate data that is embedded in a database. The only way I know to access data in a database is to use OLEBoundControl. I do not want to copy the field to a file and make changes and delete it (it's not 'embedded then and might as well just use a memo field. what would be the point of the General field type? am I completely missing something here?)
>
>In any case, I found in the Word documentation that I can access the WordBasic object of an embedded document by accessing oForm.oWord.Application.WordBasic
>
>This works unfortunately the embedded data doesn't seem to go with it.
>
Again you are mixing 2 incompatible ideas. Embedded data (general fields) are really yesterday's technology. They were used before ole automation. What it is designed is a quick link between nondbf data and the application to use that nondbf data. Automating tasks in embedded fields can only be done through keyboard commands and macros. The better approach is to move the data out of the general field (more reliable anyway as you don't have to depend on the integrity of the fpt field) and use ole automation on separate files. You can store the name of the files in a dbf table and get the same effect as an embedded field.

Is that clearer?
>I don't see any examples at www.microsoft.com/oledev/oleauto. Looks like they might have changed some things around recently or I just plain missed it.
Todd Burstain, MD
infinitydoc@delphi.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform