Micro Focus QTP (UFT) Forums
Text in Excel - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Text in Excel (/Thread-Text-in-Excel)



Text in Excel - mantis - 01-05-2012

How can i code so that write color text in Excel file by Vbscripts in QTP??
Example as i want to write Pass is green and Fail is Red?Thanks all very much!!


RE: Text in Excel - sundari_msls - 01-05-2012

Code:
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open "Excel Location"

Set objSheet = xlApp.ActiveWorkbook.Worksheets(1)  ' Take Active WorkBook
objSheet.Cells(1,1).Interior.Color = vbRed
objSheet.Cells(2,1).Interior.Color = vbGreen