XL97: Background Color Is Not Updated in ActiveX Control

ID: Q161789

The information in this article applies to:

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:

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.

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 the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/support/supportnet/refguide/

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          : kbprg kbui kbdta kbdtacode xlui KbVBA xlwin 
Version           : WINDOWS:97
Platform          : WINDOWS
Issue type        : kbprb

Last Reviewed: May 18, 1999