XL97: Background Color Is Not Updated in ActiveX Control (161789)



The information in this article applies to:

  • Microsoft Excel 97 for Windows

This article was previously published under Q161789

SYMPTOMS

When you open the Display icon in the Control Panel, click the Appearance tab, and change the setting for 3D Objects, the background color of an ActiveX control that is on a worksheet may not be updated.

RESOLUTION

ActiveX controls use the color setting that you select for 3D Objects in the Display icon in the Control Panel as the default background color. When you change the color for 3D Objects in the Display icon, the BackColor property of an ActiveX control is updated. However, the new color is not displayed on the ActiveX control until you do one of the following:

  • Exit design mode, and then click each ActiveX control in the worksheet. -or-

  • Start design mode, and then reselect the BackColor setting for each ActiveX control. -or-

  • Run a Visual Basic for Applications macro that corrects the problem.
NOTE: The "More Information" section in this article contains a sample macro that corrects this problem.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem no longer occurs in Microsoft Excel 2000.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
  1. Start the Visual Basic Editor (press ALT+F11).
  2. On the Insert menu, click Module.
  3. In Module1, type the following code:
          Sub SetBackground
    
              Dim x As OLEObject
    
              On Error Resume Next
    
              'Loop through all OLE objects on the worksheet.
              For Each x in ActiveSheet.OLEObjects
    
                  'Reset the background color.
                  x.Object.BackColor = x.Object.BackColor
    
              Next
    
          End Sub
    						
  4. On the File menu, click "Close and Return to Microsoft Excel."
  5. On the Tools menu, point to Macro, and click Macros. In the Macros dialog box, click "SetBackground" in the Macro Name list, and then click Run.
The background color of all of the ActiveX controls on the worksheet are displayed correctly.

REFERENCES

For more information about ActiveX Controls, click the Index tab in Microsoft Excel Help, type the following text

controls

and then double-click the selected text to go to the "Add buttons, check boxes, or other controls to a worksheet" topic.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbdtacode kbprb kbProgramming kbui KB161789