Help with text box background colour

irf90

New Member
Joined
Sep 29, 2014
Messages
1
Firstly I'm new to VBA, but trying to learn to make Excel more useful in work.

My company is using Excel 2003(!) and I'm trying to create custom buttons which add text boxes to selected cells - I want to create a series of buttons to create different coloured text boxes. Through lots of google searching, and some background reading I've managed to come up with the following code to create a text box the size of selected cells:
Code:
Sub TextBox()    
     If TypeName(Selection) = "Range" Then
        With Selection
            ActiveSheet.Shapes.AddTextbox _
              msoTextOrientationHorizontal, .Left, _
              .Top, .Width, .Height
        End With
    End If
End Sub

Despite numerous tries, I can't figure out what code, or where to place it to set parameters such as font size, alignment and fill colour for the text box. Any help greatly appreciated.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,214,976
Messages
6,122,541
Members
449,089
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top