-
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).]
-
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... :)
-
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?
-
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.
-
ummm, you're right, well, i'll look further myself.. meanwhile lets wait if anyone has a better answer..