Home |
Search |
Today's Posts |
|
#1
|
|||
|
|||
Text color in textbox
Hello there!
I am trying to insert a text box using VBA. I have been able to get all components of the text box to work except changing the font color. The other hurdle i'm struggling with is trying to keep the sheet locked, but allowing the user to still be able to edit this object only, and not all the other objects on the sheet. In need of more experienced VBA writers. Sub add_textbox_VBA() Dim shp As Shape ActiveSheet.Unprotect "password" Set shp = ActiveSheet.Shapes.AddTextBox(msoTextOrientationHo rizontal, 100, 100, 200, 50) ' add shape With shp .TextFrame.Characters.Text = "Example" ' add text to display .Top = Range("B2").Top ' adjust top .Left = Range("B2").Left 'adjust left .TextFrame.AutoSize = True ' turn on autosize .TextEffect.FontSize = 16 .TextEffect.FontName = "Arial Black" .Fill.ForeColor.RGB = RGB(0, 56, 150) 'choose fill color .Line.Weight = 1 ' adjust width .Line.ForeColor.RGB = RGB(0, 56, 150) ' choose color .Line.DashStyle = msoLineSolid ' choose style End With ActiveSheet.Protect "password", DrawingObjects:=False, Contents:=False, Scenarios:=False End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
TextBox Color Red if Less than 50 | Excel Programming | |||
Match TextBox Back Color to Cell Fill Color | Excel Programming | |||
Highlight all Text in a Textbox when the textbox is selected | Excel Programming | |||
Changing font color of textbox text..... | Excel Programming | |||
Browse Forms Controls and change TextBox color based on cell color | Excel Programming |