Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 16th, 2005, 06:17 PM
Registered User
 
Join Date: Mar 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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





Similar Threads
Thread Thread Starter Forum Replies Last Post
OLE Data container Apocolypse2005 Visual Basic 2005 Basics 0 September 28th, 2008 02:27 PM
Word document to user delphi VS.NET 2002/2003 0 January 11th, 2006 02:22 AM
OLE Automation Access - Word william.murray Access 2 July 13th, 2004 07:23 AM
Access OLE Merge to Word GregoryHu Access VBA 5 May 7th, 2004 10:18 AM
Access OLE to Word GregoryHu Access VBA 0 March 1st, 2004 08:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.