+ Reply to Thread
Results 1 to 4 of 4

Changing the color of a shapes' bordesr when unhiding them

Hybrid View

  1. #1
    Registered User
    Join Date
    03-30-2013
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2007
    Posts
    41

    Changing the color of a shapes' bordesr when unhiding them

    Hello all,

    I'm using the following macro (which is assigned to a checkbox) to hide/unhide the border of some shapes in a group:

    Public Sub Show_Borders(nameObject As String, indDisplay As Boolean)
    
    ActiveSheet.Shapes(nameObject).Line.Visible = indDisplay
    End Sub
    The code works, but when I hide and then unhide the borders, they are black when I unhide them. How could I add some code that would cause them to return as a color other than black?

    Any help would be greatly appreicated. Thanks!
    Jackson

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Changing the color of a shapes' bordesr when unhiding them

    Change 34 to whatever colour index you want to use
    Public Sub Show_Borders(nameObject As String, indDisplay As Boolean)
    
    ActiveSheet.Shapes(nameObject).Line.Visible = indDisplay
        With ActiveSheet.Shapes(nameObject).Line
            .ForeColor.SchemeColor = 34
            .BackColor.SchemeColor = 34
        End With
    End Sub

  3. #3
    Registered User
    Join Date
    03-30-2013
    Location
    Chattanooga, TN
    MS-Off Ver
    Excel 2007
    Posts
    41

    Re: Changing the color of a shapes' bordesr when unhiding them

    Thanks, yudlugar!

    The RGB colors I want to input are (79, 129, 189). How would I input those?

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Changing the color of a shapes' bordesr when unhiding them

    Public Sub Show_Borders(nameObject As String, indDisplay As Boolean)
    
    ActiveSheet.Shapes(nameObject).Line.Visible = indDisplay
        With ActiveSheet.Shapes(nameObject).Line
            .ForeColor.RGB = RGB(79,129,189)
            .BackColor.RGB = RGB(79,129,189)
        End With
    End Sub
    I think that works, there is also a forecolor.type but that should automatically change to msoColorTypeRGB when you change the RGB property, otherwise you will need to add .forecolor.type = msocolortypergb

+ Reply to Thread

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