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
Category Archive: MS-Word
Apr 01 2008
Add a Formatted Table to a Word Document
Demonstration script that retrieves service data from a computer and then displays that data in a formatted table in Microsoft Word Set word = CreateObject( “Word.Application” ) word.Visible = True Set doc = word.Documents.Add() Set range = doc.Range() doc.Tables.Add range, 1, 3 Set table = doc.Tables( 1 ) x = 1 sComputer = “.” Set …
Apr 01 2008
Add Formatted Text to a Word Document
Demonstration script that displays formatted data in a Microsoft Word document Set word = CreateObject( "Word.Application" ) word.Visible = True Set doc = word.Documents.Add() Set selection = word.Selection With selection .Font.Name = "Arial" .Font.Size = "18" .TypeText "Network Adapter Report" .TypeParagraph() .Font.Size = "14" .TypeText "" & Date() .TypeParagraph() End With
Apr 01 2008
Append Text to a Word Document
Demonstration script that appends the current date to the existing Microsoft Word document C:\Word\Testdoc.doc. Const END_OF_STORY = 6 Const MOVE_SELECTION = 0 Set word = CreateObject( “Word.Application” ) word.Visible = True Set doc = word.Documents.Open( “c:\word\testdoc.doc” ) Set selection = word.Selection selection.EndKey END_OF_STORY, MOVE_SELECTION selection.TypeParagraph() selection.TypeParagraph() selection.Font.Size = “14″ selection.TypeText “” & Date() selection.TypeParagraph() selection.TypeParagraph() …
Apr 01 2008
Apply a Style to a Table in a Word Document
Demonstration script that retrieves service data from a computer, displays that data in a table in Microsoft Word, then formats the data by using a predefined Microsoft Word style Set word = CreateObject( “Word.Application” ) word.Visible = True Set doc = word.Documents.Add() Set range = doc.Range() doc.Tables.Add range, 1, 3 Set table = doc.Tables( 1 …
Apr 01 2008
Create a New Word Document
Demonstration script that creates and displays a new Microsoft Word document. Set word = CreateObject( “Word.Application” ) word.Visible = True Set doc = word.Documents.Add()
Apr 01 2008
Create and Save a Word Document
Demonstration script that retrieves network adapter data from a computer, displays that data in a Microsoft Word document, and then saves the document as C:\Word\Network Adapter Report.doc. Set word = CreateObject( “Word.Application” ) word.Caption = “Test Caption” word.Visible = True Set doc = word.Documents.Add() Set selection = word.Selection With selection .Font.Name = “Arial” .Font.Size = …
Apr 01 2008
List MS-Word Properties
The function accepts a string containing text to be spell checked, checks the text for spelling using MS Word automation model, and then returns the processed text as a string. The MS Word spelling dialog will allow the user to perform available actions in the dialog. Function SpellChecker( ByVal text ) Dim wordBasic, selection Const …
Apr 01 2008
Use MS-Word to Search for Files
Demonstration script that uses Microsoft Word to locate all the .mp3 files stored on drive C of the local computer. Set word = CreateObject( “Word.Application” ) Set doc = word.Documents.Add() word.FileSearch.FileName = “*.mp3″ word.FileSearch.LookIn = “C:\” word.FileSearch.SearchSubfolders = True word.FileSearch.Execute For Each file in word.FileSearch.FoundFiles Print file Next word.Quit
Apr 01 2008
Open and Print MS-Word Document
Demonstration script that opens and prints and existing Microsoft Word document. Set word = CreateObject( “Word.Application” ) Set doc = word.Documents.Open( “c:\documents\report.doc” ) doc.PrintOut() word.Quit


Recent Comments