Page 252 - Microsoft Office Excel 2003 Programming Inside Out
P. 252

Microsoft Office Excel 2003 Programming Inside Out

                             Sub GetOurColors()
                                 ActiveWorkbook.Colors = Workbooks(“OurColors.xls”).Colors
                             End Sub

                             To copy a color palette from another workbook using the Excel interface, follow these steps:
                               1  Open the workbook from which you want to copy the color palette.
                               2  In the workbook to which you want to copy the color palette, click Tools, Options.
                               3  Click the Color tab in the Options dialog box.
                               4	 Click the Copy Colors From down arrow, and then click the name of the workbook
                                  from which you want to copy the color palette.
                             If you’ve changed the default Excel color palette, you can change it back to the default by call­
                             ing the Workbook object’s ResetColors method, as in the following procedure:

                             Sub NormalColors()
                             ActiveWorkbook.ResetColors
                             End Sub
                             To change the color palette back to the default using the Excel interface, follow these steps:
                               1  Click Tools, Options.
                               2  Click the Color tab in the Options dialog box.
                               3  Click Reset.


                    Using the Excel Color Palette on the Web
                             If you’ve used the Web a lot, you’ve probably found that some pages that appear perfectly
                             normal in one browser are a mess in another browser. Whether the spacing is off, the text is
                             larger in some paragraphs than in others, or the colors are different, you just don’t get what
                             you expect. Part of the difficulty can be traced to older Web browsers that don’t understand the
             Chapter 10
                             newer markup tags, but another reason is that some programs, such as Microsoft FrontPage,
                             tend to create code that is interpreted perfectly by Microsoft Internet Explorer but less well by
                             other browsers. Colors are no different from other HTML formatting instructions, so you
                             need to know what can cause the errors and how to avoid them.
                             Beginning with Internet Explorer 4.0, there has been a list of named colors with associated
                             RGB color values that the browser knows how to interpret. Not all browsers know how to
                             interpret the names of the colors, but every major browser is able to interpret RGB color
                             values. Table 10-4 lists the standard HTML colors and their associated RGB values so that you
                             can add them to your Excel color palette if you want to create a workbook that looks good
                             both in print and on the Web.


                             For more information on how these colors will look on your monitor, see the full-color table on MSDN,
                             the Microsoft Developer Network site, at: http://msdn.microsoft.com/workshop/author/dhtml/reference
                             /colors/colors.asp.




                226
             Part 4:  Advanced VBA
   247   248   249   250   251   252   253   254   255   256   257