+ Reply to Thread
Results 1 to 4 of 4

Multiple formats inside single text box (activex)

  1. #1
    Registered User
    Join Date
    12-23-2008
    Location
    Tulsa, Oklahoma
    MS-Off Ver
    2007
    Posts
    4

    Multiple formats inside single text box (activex)

    Hello again.

    I'm having trouble keeping the formatting correctly in a text box through VBA. I'm sure this is something simple, but I'm the intern that got stuck with trying to program for the break since they know I've taken classes on the subject. I've been able to figure out a lot, which I owe a great amount of thanks (THANK YOU!) to this forum and the handy search function. However, I couldn't find any pertinent information regarding this topic.

    End goal: To have the first word of a text box larger, underlined, and bolded.

    Problem: It only formats it Calibri at 24 point with no special formatting as indicated in the code.

    Please Login or Register  to view this content.
    Thank you for looking,

    Cody Martin
    Last edited by CodyMartin; 12-30-2008 at 11:02 AM. Reason: Slight Edit of code

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello CodyMartin,

    A VBA TextBox control can have only 1 formatted font and font color applied to the text. What you are describing is a RTF (Rich Text Format) control which VBA doesn't support.

    Sincerely,
    Leith Ross

  3. #3
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    Cody,

    How is your textbox added to your sheet. Is it a drawing object or an OLEObject?
    It looks like you reference it as

    Sheet6.txtMidCon

    In my limited experience with textboxes I usually have to reference a drawing object textobx as a shape and the various objects within the shape accordingly:

    i.e.
    Please Login or Register  to view this content.
    have you tried recording a macro and making the desired changes to your textbox to see the code?
    Last edited by royUK; 12-30-2008 at 11:04 AM. Reason: add code tags

  4. #4
    Registered User
    Join Date
    12-23-2008
    Location
    Tulsa, Oklahoma
    MS-Off Ver
    2007
    Posts
    4
    I switched from an Active X control to just a basic form text box and it seems to be working now... since I found some random code that was using Selection.xxxxx later in my code (I meant to take it out, I guess that's what trying to code all day does to you!) that was resetting my formatting for it also. Thank you for the help everyone -- knowing that the Active X text box doesn't support RTF will be useful information.

    Thank you,

    Cody Martin

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1