Consulting

Results 1 to 7 of 7

Thread: changing textbox colour?

  1. #1
    VBAX Regular
    Joined
    Nov 2007
    Posts
    16
    Location

    changing textbox colour?

    hi is it possible changing the textbox colour like a normal textbox because ive tried using a macro and it wont show the colour change of the textbox...

  2. #2
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    Font colour, background colour, or border colour? Also, are we talking about a textbox on a userform or a worksheet?
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    VBAX Regular
    Joined
    Nov 2007
    Posts
    16
    Location
    Quote Originally Posted by rory
    Font colour, background colour, or border colour? Also, are we talking about a textbox on a userform or a worksheet?
    WorkSheet and its the textbox font colour

  4. #4
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    If it's a textbox from the drawing toolbar, you can use:
    [VBA]ActiveSheet.TextBoxes(1).Font.ColorIndex = 12[/VBA]
    syntax.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    VBAX Regular
    Joined
    Nov 2007
    Posts
    16
    Location
    Quote Originally Posted by rory
    If it's a textbox from the drawing toolbar, you can use:
    [vba]ActiveSheet.TextBoxes(1).Font.ColorIndex = 12[/vba]
    syntax.
    i dont understand why you've written Font.ColorIndex = 12 ?!?!? and if i wanted it green how would i do that?

  6. #6
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    Because you didn't say what colour you wanted, so I just picked one. Using a default colour palette, you could use 10 instead of 12 to get green, I think. Or you could use .Color = vbGreen instead of using .Colorindex, and you'll get the closest match to an available colour.
    Regards,
    Rory

    Microsoft MVP - Excel

  7. #7
    VBAX Regular
    Joined
    Nov 2007
    Posts
    16
    Location

    Talking

    Quote Originally Posted by rory
    Because you didn't say what colour you wanted, so I just picked one. Using a default colour palette, you could use 10 instead of 12 to get green, I think. Or you could use .Color = vbGreen instead of using .Colorindex, and you'll get the closest match to an available colour.
    Thank you that was the solution thank you very much i got it work as well heheheh code i used was:
    [VBA]
    ActiveSheet.TextBoxes.Font.ColorIndex = 12
    [/VBA]

    I didnt add the (1) so i could change all the textbox colour ... but thanks alot it helps alot ....

Posting Permissions

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