Tag Archive: excel

Mar 30 2009

Quickly import excel to Quicktest

Olga Ivolgin gives us a wonderfully useful QTip – quickly import an excel datasheet with the column names!

May 01 2008

Read Excel Range into an Array

Usually, we only want to read some data from an Excel worksheet, and we’ll be more than happy to get that data in a simple 2-dimensional array. Later we can loop through the array, and access the data in a quick and easy fashion. Here’s a function which receives an Excel file, the workbook name …

Continue reading »

Apr 01 2008

Add Data to a Spreadsheet Cell

Demonstration script that adds the words “Test Value” to cell 1,1 in a new spreadsheet. Set excel = CreateObject( “Excel.Application” ) excel.Visible = True excel.Workbooks.Add excel.Cells( 1, 1 ).Value = “Test value”

Apr 01 2008

Add Formatted Data to a Spreadsheet

Demonstration script that adds the words “test value” to a new spreadsheet, then formats the cell containing the value. Set excel = CreateObject( “Excel.Application” ) With excel .Visible = True .Workbooks.Add .Cells( 1, 1 ).Value = “Test value” .Cells( 1, 1 ).Font.Bold = True .Cells(1, 1).Font.Size = 24 .Cells(1, 1).Font.ColorIndex = 3 End With

Apr 01 2008

Format a Range of Cells

Demonstration script that adds data to four different cells in a spreadsheet, then uses the Range object to format multiple cells at the same time. Set excel = CreateObject( “Excel.Application” ) With excel .Visible = True .Workbooks.Add .Cells( 1, 1 ).Value = “Name” .Cells( 1, 1 ).Font.Bold = True .Cells( 1, 1 ).Interior.ColorIndex = 30 …

Continue reading »

Apr 01 2008

List Excel Color Values

Demonstration script that displays the various colors — and their related color index — available when programmatically controlling Microsoft Excel Set excel = CreateObject( “Excel.Application” ) With excel .Visible = True .Workbooks.Add For i = 1 to 56 .Cells( i, 1 ).Value = i .Cells( i, 1 ).Interior.ColorIndex = i Next End With

Apr 01 2008

List Service Data in a Spreadsheet

Demonstration script that displays the various colors — and their related color index — available when programmatically controlling Microsoft Excel Set excel = CreateObject( “Excel.Application” ) With excel .Visible = True .Workbooks.Add End With x = 1 Set wmiService = GetObject( “winmgmts:root\cimv2” ) Set colServices = wmiService.ExecQuery( “Select * From Win32_Service” ) For Each service …

Continue reading »

Apr 01 2008

Make your Excel Speak!

Microsoft Excel is the only Microsoft Office XP program that has built-in Text to Speech (TTS) capabilities. This tip explains how you can use OLE Automation to programmatically access the Excel object model and use the Text to Speech functionality. Set excel = CreateObject( “Excel.Application” ) excel.Speech.Speak “Advanced QTP” Set excel = Nothing