title: VBA Change form control background color
body: <p>I'm trying to change the background color of a form control checkbox via VBA code. I've tried every variation of code I can find on the internet and am still getting failures.</p>
  
  <p>The line I have currently is below, and is the only one I've found so far that doesn't give me compiler errors. When I run it though I get a "Run-time error '438': Object doesn't support this property or method" error on executing this line. This is true whether I set it = to xlBlack, RGB(255,255,255) or "11398133" (not black I know, but I was just trying to see if any color would work).</p>
  
  <p>Anyone know what's going on and how I can actually do this?</p>
  
  <pre><code>    Sheets("Controls").Shapes.Range(Array("Check Box 8")).BackColor = "11398133"  
  </code></pre>
  
  <p><strong>Answer</strong><br>
  I found the answer. For some reason none of the responses worked, but Johnny's answer did help me get closer to it by loading the right object in memory and I could then use the Locals window to track down the property I wanted.</p>
  
  <p>In the end it was identifying the object as Johnny suggested and then just cb.Interior.Color = xlBlack I was looking for. No .Fill and no .DrawingObject. Not sure what makes this different than others that would make that work that way, but there you go.</p>
  
  <p>So, for any others who come looking, the code that ended up working for me was the simple addition of the below, and you can find out what the Excel name of the object is (Check Box 8 in my case) by selecting it while recording macros.</p>
  
  <pre><code>    For Each cb In Sheets("Controls").CheckBoxes
          If cb.Name = "Check Box 8" Then
              cb.Interior.Color = xlNone
              Exit Sub
          End If
      Next
  </code></pre>