Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 12
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TextBox Color Red if Less than 50 Shazi Excel Programming 3 August 4th 08 10:37 PM
Match TextBox Back Color to Cell Fill Color AMY Z. Excel Programming 4 October 12th 06 06:07 PM
Highlight all Text in a Textbox when the textbox is selected RPIJG[_73_] Excel Programming 3 October 28th 05 08:28 PM
Changing font color of textbox text..... jan Excel Programming 5 January 31st 05 08:10 PM
Browse Forms Controls and change TextBox color based on cell color StefanW Excel Programming 2 November 21st 04 07:06 PM


All times are GMT +1. The time now is 01:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"