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

Part 3:  The Excel Object Model
                                        Microsoft Office Excel 2003 Programming Inside Out







                             Figure 7-4.  The Favorites list contains links to files and hyperlinks you want to remember
             Chapter 7
                             and access quickly.

                             Tip  Make Your Favorites Easy to Find
                             Of course, you can add the Favorites toolbar button to any toolbar by clicking Tools, Customize,
                             Commands to display the Commands page of the Customize dialog box. Then, in the Cate;
                             gories pane, click Web and drag Favorites from the Commands pane to the toolbar where
                             you want the Favorites list to reside.

                             You invoke the AddToFavorites method to add a workbook to the Favorites list using any
                             method attached to an object that references a workbook object, as in the following two code
                             fragments:

                             ActiveWorkbook.AddToFavorites
                             ThisWorkbook.AddToFavorites

                             FollowHyperlink Method
                             One useful way to create help and informational files for the Excel applications you create is
                             to save them as Web pages, which lets you set up a series of hyperlinks users can click to get
                             help on using a form or other object. The following code listing presents the basic syntax of the
                             FollowHyperlink method, with Table 7-4 fleshing out the details of the most-used parameter.

                             expression.FollowHyperlink(Address,  SubAddress,  NewWindow,  ExtraInfo,  Method,
                             HeaderInfo)
                             Table 7-4.  The Parameters of the FollowHyperlink Method
                             Parameter     Type             Description

                             Expression    Required         An expression that returns a Workbook object.
                             Address       Required String   The address of the target document.
                             SubAddress    Optional Variant   The location within the target document. The default
                                                            value is the empty string.
                             NewWindow     Optional Variant   True to display the target application in a new
                                                            window. The default value is False.

                             You won’t need to set most of these parameters when you use the FollowHyperlink method,
                             but the NewWindow parameter does come in handy when you want to be sure that the docu-
                             ment you open appears in a separate window and doesn’t overwrite any existing information.
                             The parameters that are listed in the code but not in the table are only used if you need to call


                146
   167   168   169   170   171   172   173   174   175   176   177