TIP: Click on subject to list as thread! ANSI
echo: ms_word
to: ALL
from: JIGAL VAN HEMERT
date: 1997-08-08 18:45:00
subject: Word as OLE automation server

* Crossposted in VISUAL_BASIC
* Crossposted in MS_WORD
* Crossposted in WIN95
High! All,
I'm having trouble using MS Word 7 as an OLE automation server from MS
Access 7. This is what I'm trying to achieve:
- an Access table contains an OLE Data type field.
- when creating a new record, I'll have to manually insert a bound
(embedded) OLE object of the type MS Word Document.
- I'd like the bound OLE object to be automatically created and embedded
in the database.
I used the following approach.
- upon entering new information the BeforeInsert event is triggered.
This is an ideal time to fill fields with precalculated information.
'Cause someone suggested that the record might not yet exist I hooked
the code to the AfterUpdate event of the first text field, getting the
same 'result'
- This is the code I used for creating and embedding the object:
    Static oDummy As Object     
        'a dim used too much stack space
    Set oDummy = CreateObject ("Word.Basic")
        'Word only supports the Basic object for OLE automation
    oDummy.FileNewDefault
        'to create a new document
    Me![Article] = oDummy
        'to put it in the field
       
The result was disappointing; CreateObject did not result in the
creation of an OLE object. That is it creates an error and puts the
result in oDummy. Starting Word beforehand showed that the
oDummy.FileNewDefault caused Word to start a new doc!
Me![Article] = oDummy ends up in an invalid page fault in OLEAUT32.DLL,
crashing Access in the process.
HELP!!! How can I create and embed an empty Word document in an Access
database field?
                     ___   __   __
Happy programming,  /   | / /__/ /
                ___/ /| |/ ___  /
Jigal.         /____/ |___/  /_/
--- Terminate 4.00/Pro
---------------
* Origin: Point 2 is a point too at Revolution Ballroom (2:281/721.2)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.