Results 1 to 1 of 1

Setting Fill color for Textboxes

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,963

    Setting Fill color for Textboxes

    I have the code below to set the color for my text boxes, but my problem is that I can't find the right code for what I want for my SchemeColor. I've looked online at all the listings of colors in Excel (including here: http://dmcritchie.mvps.org/excel/colors.htm), and the codes don't match up with my experience. For instance, light gray is supposed to be 15, but when I replace 1 with 15, my textboxes turn aqua. The closest I've come is by putting 1, and I've ascertained that there are 80 possible values, but trial and error is no way to find the right code. What I want is a very light gray, say 5% gray, just enough to stand out from the white background. Any help on this is greatly appreciated.

    Sub FormatTextboxes()
        Dim ws As Worksheet
        Dim shp As Shape
        
        For Each ws In ActiveWorkbook.Worksheets
            For Each shp In ws.Shapes
                If shp.Type = msoTextBox Then
                    With shp
                        .Fill.ForeColor.SchemeColor = 1
                        .Fill.ForeColor.TintAndShade = -0.2
                        .Shadow.Type = msoShadow5
                    End With
                End If
            Next
        Next
    End Sub
    Last edited by Mordred; 08-30-2011 at 01:12 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1