How can I change the font (or other aspects) of numbers in spreadsheets?
The functions in Statistica Visual Basic are organized in an intuitive hierarchical object model; see also What is meant by the term "object model?". The example program shown below illustrates the hierarchical nature of the objects, and the available respective methods and properties. Note that in order to review all available objects, methods, and properties, as well as constants that are recognized, you can always display the Object Browser.
The Object Browser can be displayed by clicking the Object Browser toolbar button (on the Macro toolbar), or by selecting Object Browser from the View menu.
Shown below is a simple example program that will change the font of the first column of the currently active input data spreadsheet to italic and bold.
Sub Main
' Find the currently active input spreadsheet, and ' assign it to variable (object) InSpr; note ' that ActiveSpreadsheet is a property of the ' current default (Statistica) Application; if no ' input Spreadsheet is currently open, then an ' error message will be issued. Dim InSpr As Spreadsheet Set InSpr = ActiveSpreadsheet ' Select all numbers in the first column of the ' spreadsheet; note that the CellsRange property ' returns an object of type Range; here is the ' complete syntax (see also the Object Browser): ' Property CellsRange( ' FirstRow As Long, FirstColumn As Long, ' LastRow As Long, LastColumn As Long) ' As Range ' Note also that the underscore _ at the end of ' a line, after a blank, means that the next line ' is interpreted as a continuation of the respective ' command. Dim Cells As Range Set Cells = InSpr.CellsRange( _ 1, 1, _ InSpr.NumberOfCases, _ 1) ' Cells is a Range object; one of the properties ' of the Range object is the Font; now set the font; ' the font is accessible as a Font object. Dim CellFont As Font Set CellFont = Cells.Font ' Italic and Bold are properties of the Font. CellFont.Italic = True CellFont.Bold = True
End Sub