Consulting

Results 1 to 2 of 2

Thread: Shape Fill Color Does Not Change (Excel 2013)

  1. #1

    Shape Fill Color Does Not Change (Excel 2013)

    I'm trying to create shapes that will be applied to a sheet from a userform, and be populated with the userform data. I am successfully creating the rounded rectangle shape, placing the shape, sizing the shape and changing the text in the shape. But for whatever reason the fill color does not change from the default color setting. Awhile back I set the default shape to a shape with a green fill color. Now I am trying to create a shape with VBA and I want to fill it with a blue color, but the shape is always the default green color. Is it an issue if I set the default color different from the original Excel default? Or am I missing something simple in the code? I've sadly wasted half a day with this little issue, and once again need help.

    Sub AddButtons()
    Dim Names           As String
    Dim Captions        As String
    Dim LeftPos         As Long
    Dim newBtn          As Shape
    
    shtnm = ThisWorkbook.ActiveSheet.Name
    
    With ThisWorkbook.Sheets(shtnm)
    Names = "Btn1"
    Captions = ENGForm.DocName1.Value
    LeftPos = 165
    Set newBtn = .Shapes.AddShape(msoShapeRoundedRectangle, Left:=LeftPos, Top:=225.5, Width:=105.75, Height:=52.5) With newBtn .Name = Names .TextFrame.Characters.Text = Captions .Fill.BackColor.RGB = RGB(136, 182, 224) End With End With End Sub

  2. #2
    Wow, okay. I can't believe I was stumped for so long with this issue. I just realized with a shape the fill color is the ForeColor not the BackColor! I guess I need to take a break from this for awhile.

Posting Permissions

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