Loading a word document into an OLE container
Please help,
I have an OLE container on a form and I need to load the word document into the object through code. I have found code from a Wrox book in fact just for this:
Sub LoadOLEControl()
Dim nFileNumber As Integer
nFileNumber = FreeFile
Open "c:\training certificate pieces.doc" For Binary As #nFileNumber
OLE1.SourceDoc = nFileNumber
*OLE1.ReadFromFile nFileNumber
Close #nFileNumber
End Sub
I copied this code right out of the book and I am getting a weird error on the line of code with the asterisk.....
Run-time error '31037'
System error &h800401c2(-2147221054). Contents of the OLESTREAM not in correct format.
Please Help!!!
Thanks
|