Microsoft KB Archive/161789

= XL97: Background Color Is Not Updated in ActiveX Control =

Article ID: 161789

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Excel 97 Standard Edition

-



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:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

 Start the Visual Basic Editor (press ALT+F11). On the Insert menu, click Module.  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  On the File menu, click "Close and Return to Microsoft Excel." 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.</ol>

The background color of all of the ActiveX controls on the worksheet are displayed correctly.

<div class="references_section">