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

Part 3:  The Excel Object Mode
                                                     The Application Object

                             Str$(Year(Now())), "ddd")
                                 Range("C6:C8").Select
                                 Selection.AutoFill Destination:=Range("C6:C36"), Type:=xlFillDefault
                                 'Autofill remaining days
                                 Range("C6:C36").Select   'Correct borders
                                 With Selection.Borders(xlEdgeRight)
                                    .LineStyle = xlContinuous
                                    .Weight = xlThin
                                 End With
                                 Range("C36").Select
                                 With Selection.Borders(xlEdgeBottom)
                                    .LineStyle = xlContinuous
                                    .Weight = xlThin
                                 End With

                             End Sub




























                             Figure 6-4.  This macro creates a new worksheet based on an existing template but adds
                             the correct weekday and date for the upcoming month as well as the unchanging hour
                             column headings.

                             ActiveWindow Property
                             The ActiveWindow property returns a Windows object that represents the currently selected
                             window within the Excel application. The ActiveWindow is always the topmost window
                             within an application.
                             The Caption property of a Window object also doubles as a Name property. When you assign   Chapter 6
                             a value to the Caption property, you make it possible to refer to a particular window in the



                                                                                                       113
   134   135   136   137   138   139   140   141   142   143   144