ColumnHeadings Property

Microsoft Office Web Components Visual Basic

expression.ColumnHeadings

expression    Required. An expression that returns a Window object.

Example

This example sets the creates a custom data entry sheet by disabling some user interface elements, limiting the viewable range in the active window, and customizing the row and column headings.

Sub Create_Datasheet()
    Dim hdrColHeadings
    Dim hdrRowHeadings
    Dim wndActive

    Set wndActive = Spreadsheet1.ActiveWindow

    ' Hide various UI elements.
    wndActive.DisplayWorkbookTabs = False
    Spreadsheet1.DisplayToolbar = False

    ' Display the title bar and set it's caption.
    Spreadsheet1.DisplayTitleBar = True
    Spreadsheet1.TitleBar.Caption = "Revenue Worksheet"

    ' Resize the spreadsheet component.
    Spreadsheet1.AutoFit = True

    ' Limit the viewable range of the active sheet.
    wndActive.ViewableRange = "A1:D5"

    ' Set a variable to the column headings in the active window.
    Set hdrColHeadings = wndActive.ColumnHeadings

    ' Set a variable to the row headings in the active window.
    Set hdrRowHeadings = wndActive.RowHeadings

    ' Set the headings of columns A through D.
    hdrColHeadings(1).Caption = "Qtr 1"
    hdrColHeadings(2).Caption = "Qtr 2"
    hdrColHeadings(3).Caption = "Qtr 3"
    hdrColHeadings(4).Caption = "Qtr 4"

    ' Set the headings of rows 1 though 5.
    hdrRowHeadings(1).Caption = "1996"
    hdrRowHeadings(2).Caption = "1997"
    hdrRowHeadings(3).Caption = "1998"
    hdrRowHeadings(4).Caption = "1999"
    hdrRowHeadings(5).Caption = "2000"
End Sub