Results 1 to 15 of 15
  1. #1
    JustCallMeAl
    Guest

    RichTextBox Control (Word97 SR2)

    For Word97, I am needing a rich text box control.

    Before you suggest the control from MS, Richtx32.ocx, it has a bug in it that makes it unusable.

    The bug can be confirmed by the following: Create a form, put a multipage and a command button on it. Add some pages (the bug might "work" with only the two pages, but I have had more than that in all my testing).

    Add MS rich text box control. Leave the default .text value alone.

    In the commandbutton_click event, put msgbox ""

    Place a break point on that msgbox.

    Run the form.

    Click the command button.

    Go to the immediate window and enter:

    ?UserForm1.RichTextBox1.text and press enter.

    You will get the value in the rich text box.

    Press F5 to continue running. Click the message box button.

    Change focus to one of the other pages, one without the richtextbox control.

    Click the command button.

    Recheck the .text value in the immediate window.

    I get a blank string.

    Tried this multiple times, with multiple forms. When the focus is off the multipage containing the richtextbox, the richtextbox does not return a .text value.

    Any alternatives for a richtextbox control?

    Al

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: RichTextBox Control (Word97 SR2)

    Hey Al,

    Nice to see you posting around here again. Have you tried the CCRP? I recall they had a RT control.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    JustCallMeAl
    Guest

    Re: RichTextBox Control (Word97 SR2)

    CCRP didn't have it. Thanks, though.

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: RichTextBox Control (Word97 SR2)

    This is an interesting problem. But, I think there's more to this than meets the eye. It may look like a bug, but hold on. Testing in progress. I'll post back later.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  5. #5
    JustCallMeAl
    Guest

    Re: RichTextBox Control (Word97 SR2)

    One thing to keep in mind is that I believe the control is a VB6 control. Word97 uses VB5 version of VBA. It is my suspicions that that may be the cause of the "bug."

    Oh, thanks for the welcome.

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: RichTextBox Control (Word97 SR2)

    It's not a Word 97 thing. I'm testing this on 2002 (SP1) - RichText Control Version 6.0. Same problem to the tee.

    You're welcome for the welcome.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: RichTextBox Control (Word97 SR2)

    Could you work around this by adding another control name into the dotted string? Something like UserForm.TabName.ControlName.Value? I haven't had a need to use more than two tabs or to refer to controls on different tabs in my own solutions, so I can't say whether that would work or not. You wouldn't think it should be necessary, but then...

  8. #8
    Star Lounger
    Join Date
    Aug 2001
    Location
    GA
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: RichTextBox Control (Word97 SR2)

    If you just need the Rich textbox's text value(unformated) you could set up a hidden textbox on your form and use the Rich Textbox's Change event to copy its value to the hidden textbox. Then you could reference the hidden textbox's .Value to retrieve the text. Another way, a bit better would be to use the Richtextbox's .Tag in the same manner. Now you get get the value of the Rich textbox by referencing its Tag even if the control is on a tab that is not selected.

    If you need to maintain the text formating of the RichTextControl then I think you need to step up to using the API sendmessage. A couple of calls with the SendMessage API should get it done.
    This link will put you right in the middle of the mix. http://msdn.microsoft.com/library/default....ditcon_3xyr.asp
    You'll have to weed through it to get going. Ass usual, Microsoft doesn't spell anything out for you. Maybe someone can take a look and get the basic couple of calls needed and post back.
    later,
    Bruce

  9. #9
    JustCallMeAl
    Guest

    Re: RichTextBox Control (Word97 SR2)

    I have already come up with another workaround, the problem as I see it is that I can't rely on the integrity of the control. If it won't work in this particular situation, who's to say it will work in others. As I stated in the first post (I think), I believe this is a VB6 control and Word97 is in VB5. Does that have something to do with this? I don't know, but I am suspicious that it does.

    Regarding multiple tabs, this particular userform has 26 tabs. It will function as a very complex "wizard" with pages (multipage1.page) becoming visible and invisible based on what the user selects on the first page.

    Are they all needed? Yes. I am moving our procedures away from a "linear" approach--you fill in this user form, then you get a second, which when you are done with it, you get a third, etc.--to a "nonlinear" approach--Oops I forgot something, ::click:: and there you are.

    Then after all the data is gathered, the document is created. This general process has worked very well for us over the last couple of years.

  10. #10
    JustCallMeAl
    Guest

    Re: RichTextBox Control (Word97 SR2)

    ::chuckle:: I wouldn't use my time trying to get something to work when I don't need its unique functionality. Therefore, yes, I need the formatting capability.

    The link you gave certainly did dump me in the middle of the mix. So in the middle that I haven't the foggiest idea what this is about.

    Let me share with you what we would like to do with this.

    As I suspect with every law firm, we have to check for conflicts when we take on a new client. When we request the information, there is a text box in which the secretary/attorney is to enter a description of the work. That description can contain words/terms which will be used to search for conflicts.

    Several secretaries, after the request document is created, will go back and bold the specific words/terms, so they do not have to retype them. Then they tell the searcher what the significance of the bold words are.

    In a regular textbox, you cannot bold words.

    In the RTF one, you can. Therefore, I was going to use it so the secretary/attorney could enter the information, bold the words/terms at that point, then continue on. A little creature comfort. My entire goal is that when they enter the data into the userform, they will not have to edit that information at a later time. Therefore, I was using the richtextbox control, which produced the problem noted above.

    At this point, I have thrown out the concept. However, if there is some way to do this without the secretary retyping words/terms, I am interested in knowing how.

  11. #11
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: RichTextBox Control (Word97 SR2)

    Al,
    I definitely like your approach --non linear. I designed my app just like that for all those reasons. Page after page (form after form) gets tedious. Users like a smoother operation with intuitive thinking going on in the background.

    My idea for a workaround goes like this:

    Pubic rtbText as string
    Sub richtextbox1_selchange
    rtbText = richtextbox1.text
    end sub

    No matter which tab page is on top, your richtext text is available.

    The Richtext Control is a fantastic control. I wouldn't worry about it.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  12. #12
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: RichTextBox Control (Word97 SR2)

    Hi Al,

    What about using some kind of markup to tag the text, and then apply bold when it's inserted into the document? - see attached demo.

    Regards,
    Gary
    Attached Files Attached Files

  13. #13
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: RichTextBox Control (Word97 SR2)

    I'm a bit hazy on this application; you are looking through the text for bold words and then soliciting an explanation for why they are bold? Perhaps instead you could have a button to "Add Comment" and operate on selected text instead. Instruct the user that to save time later, she can select the relevant text in a multiline text control and click the Add Comment button. Admittedly, not as sexy as rich formatting, but easy to code.

    UserForm1.TextBox1.SelText

    is the property you want if you go this route. (I tested in Word 2000, but assume the forms object model is teh same.)

  14. #14
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: RichTextBox Control (Word97 SR2)

    Al,
    What do you know about this control?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  15. #15
    JustCallMeAl
    Guest

    Re: RichTextBox Control (Word97 SR2)

    Looking into it. A good candidate.

Posting Permissions

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