XL97: Background Color Is Not Updated in ActiveX Control

Last reviewed: February 27, 1998
Article ID: Q161789
The information in this article applies to:
  • Microsoft Excel 97 for Windows

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. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Microsoft provides examples of Visual Basic for Applications procedures 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. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.

  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.


Additional query words: XL97
Keywords : kbcode kbprg kbui xlwin xlui
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 27, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.