Add Format Controls to a textbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nieltz
    New Member
    • Feb 2007
    • 3

    #1

    Add Format Controls to a textbox

    Is it Possible to add Format Controls on my UserForm to Edit the Text in my Textbox, like it has them in Word or Excel in the Format bar?

    Like For example change Textcolor or Fontsize or Alignment?
  • willakawill
    Top Contributor
    • Oct 2006
    • 1646

    #2
    Hi. The fast answer is to download this code and work through it to learn how it is put together

    Comment

    • iburyak
      Recognized Expert Top Contributor
      • Nov 2006
      • 1016

      #3
      Go to Project - Components and select Microsoft Common Dialog Control 6.0

      1. To change color

      [PHP]
      CommonDialog1.S howColor

      Text1.BackColor = CommonDialog1.C olor
      or
      Text1.ForeColor = CommonDialog1.C olor [/PHP]

      2. To change Font.

      [PHP]CommonDialog1.S howFont


      Text1.FontBold = CommonDialog1.F ontBold
      Text1.FontItali c = CommonDialog1.F ontItalic

      Text1.FontName = CommonDialog1.F ontName
      Text1.FontSize = CommonDialog1.F ontSize[/PHP]

      3. To change alignment
      [PHP]Text1.Alignment = vbLeftJustify
      Text1.Alignment = vbRightJustify
      Text1.Alignment = vbCenter[/PHP]

      Comment

      • iburyak
        Recognized Expert Top Contributor
        • Nov 2006
        • 1016

        #4
        Originally posted by willakawill
        Hi. The fast answer is to download this code and work through it to learn how it is put together
        Oops ....
        Didn't see your respond.

        Sorry.

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          It's important to keep in mind that the TextBox control will apply all attributes to the entire control, not to a specific part of the text. For word-processor type formatting capabilities, you'll want to look at the RichTextBox control.

          Comment

          Working...