Open .Doc File in vb6 textbox or rich textbox with formating....

Here is the thing

I want to do the fellowing.

open a word doc file with formating or an html page with formating into a text box or rich text box
and then create a flash file based on the text given that is like a flash book
is should be able to output a swf and a exe.

this is my goal i can handle the flash part but i need help in the programming.

please try to avoid activex controls or other types and don't want those app thing

keep the depedencies to a minimum please thx alot
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use the webbrowser component. From the IDE, CTRL+T select "Microsoft Internet Controls" and add it to your form. Then just naviagte to your document:

Webbrowser1.Navigate2 "c:\myDoc.doc" or for the webpage
Webbrowser1.navigate2 ""
Ethen_huntAuthor Commented:
well that opens the word application or ask me to save the file

i want to open it in a text box m8

thx for your reply tho.
You can use the RichTextBox control to do it for .RTF files -- RichTextBox1.LoadFile "file.rtf" -- but I don't think it will work for .doc files...

I think bingie's got the best option -- the Open/Save dialogue you get is a security setting that you may be able to turn off...

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

And if you want any kind of Word functionality, without using the Word object, I think you'll need a spare $1300 (ish) for the tools at Aspose (

Either that, or you'll need to parse the entire file format yourself...

I have yet to find a better solution then using the webbrowser component, since the rtb doesn't really work for this - it somtimes messes up the formatting since a word doc is compleatly different from a .txt or .rtf.

Why are you opposed to that?
Ethen_huntAuthor Commented:
well i am not i need to get the text with the formating intact so i can change few things and process it. if you can provide any code that will disable the security thing for a temp time i might go that way then. :D
>>  if you can provide any code that will disable the security thing for a temp time

OK, the theory is:

      On file load:
      (1.)  Scan the HKEY_CLASSES_ROOT registry branch for the '.doc' subbranch
      (2.)  Determine the associated class from the '(default)' key
      (3.)  Scan the HKCR branch again, for the associated class' subbranch
      (4.)  Modify the 'EditFlags' key so that the third flag is 01, not 00
      (5.)  Navigate to the .doc file in the Webbrowser control
      (6.)  Modify the 'EditFlags' key so that the third flag is whatever it was before.

When I've written and tested it, I post it here...

OK, using the Complete Registry Class from

    Private Sub CommandButton1_Click()
        Dim oReg As New cRegistry
        Dim szDocClass As String
        Dim a_byEditFlags() As Byte
        Dim byOldFlag As Byte
        '(1.)  Scan the HKEY_CLASSES_ROOT registry branch for the '.doc' subbranch
        oReg.ClassKey = HKEY_CLASSES_ROOT
        oReg.SectionKey = ".doc"
        '(2.)  Determine the associated class from the '(default)' key
        oReg.ValueKey = ""
        oReg.ValueType = REG_SZ
        szDocClass = oReg.Value
        '(3.)  Scan the HKCR branch again, for the associated class' subbranch
        oReg.SectionKey = szDocClass
        oReg.ValueKey = "EditFlags"
        oReg.ValueType = REG_BINARY
        a_byEditFlags() = oReg.Value
        ReDim Preserve a_byEditFlags(UBound(a_byEditFlags()) - 1)
        '(4.)  Modify the 'EditFlags' key so that the third flag is 01, not 00
        byOldFlag = a_byEditFlags(2)
        a_byEditFlags(2) = 1
        oReg.Value = a_byEditFlags()
        '(5.)  Navigate to the .doc file in the Webbrowser control
        WebBrowser1.Navigate2 "file:///d:/test.doc"
        Do Until WebBrowser1.ReadyState = READYSTATE_COMPLETE
        '(6.)  Modify the 'EditFlags' key so that the third flag is whatever it was before.
        a_byEditFlags(2) = byOldFlag
        oReg.Value = a_byEditFlags()
        Set oReg = Nothing
    End Sub



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If that doesn't work then you're going to need to use the Word object...

Ethen_huntAuthor Commented:
well thx alot for the help but i can't use a 3rd party code :(

i am haveing a problem in one thing and if you help me i will give you the full points.

i have a word doc in which i want to take a name form the access database and put in a position and then from vb6 give a print command after displaying the printing dialog box

basicly i want a front sheet  to be printed if you know what i mean if not reply and i will try my best. :D

thx once again.
Thanks for the points.  Why no third party code?  It's just a .bas file that you drop in to your app.  You don't have to install it, or anything.  If third-party code is really a problem, do a Google search for the API required to read/write registry values, then replicate it.

As for your front sheet, how about creating a page at the beginning of the document, with some form fields, then using Mail Merge or ADO to populate them...

Ethen_huntAuthor Commented:
you mean a form in MS word ? and if that is possible can i print the form directly from vb?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.