Results 1 to 5 of 5

Thread: Automation with Access97 and Word

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Ohio
    Posts
    59

    Post

    I'm using VB6 to automate creating a word document based on data that a user enters into a form that is stored into an Access 97 database.
    I can get the text from the database fields and replace them in the word document but I can't figure out how to "cut and paste" an OLE object.

    I have an OLE object field in access that stores a Word or Excel document (embedded) that the user updates. I want to copy that ole object and insert it into the final Word doc that I am creating programatically.

    I can do this by manually copying and pasting from Access to Word.

    Thanks.

    [This message has been edited by JasonS (edited 02-21-2000).]

  2. #2
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232

    Post

    i think you could avoid the use of clipboard by just setting the text to the value you have, something like (i don't have the correct syntax at hand so you'd need to check): objWord.Selection.Text = data

    the same approach i think you could use with the OLE object, like objWord.AddObjects or something, look it up.. it's there

    he who look shall find...

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Ohio
    Posts
    59

    Post

    This is the code I'm using to insert the text fields into the word document:

    With ObjWord.Selection.Find
    .Text = Header
    .Execute Forward:=True
    End With
    '.ClearFormatting
    Clipboard.Clear
    Clipboard.SetText (Data)
    ObjWord.Selection.Paste
    Clipboard.Clear


    Anyone have any ideas for the OLE object?

  4. #4

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    Ohio
    Posts
    59

    Post

    I had already looked at the word browser objects and everthing that I've found has a reference to a filename. For instance the .inlineshapes.addoleobject function allows you to enter the class name if you want to create a new doc or a filename if you want to link or embed the file.

    My file is already embedded in the Access table so this reference won't work. I get errors if I try to use that function.



  5. #5
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232

    Post

    ummm, you're right, well, i'll look further myself.. meanwhile lets wait if anyone has a better answer..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width