Micro Focus QTP (UFT) Forums
Excel and Driver Script - 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: Excel and Driver Script (/Thread-Excel-and-Driver-Script)



Excel and Driver Script - shipu - 02-27-2014

Hi,

I have driver script that opens two qtp files: Test1 and Test2.

1. Test1:
Code:
Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Visible = True

Dim FilePath
FilePath = "W:\T.xlsx"

Set ExcFile = ExcelApp.Workbooks.Open (FilePath)
Set SheetOne = ExcFile.Worksheets("QTP")

ExcelApp.Cells(12, 8).Value = "first"

2. Test2:
Code:
ExcelApp.Cells(13, 8).Value = "second"

When I run the driver script, it opens Test1 and enter "first" in cell(12,8) during Test1 run but it does not enter "second" in cell(13,8) during Test2 run.

Both tests must enter data into the "QTP" sheet of the same excel file.

Please help.

-S


RE: Excel and Driver Script - supputuri - 02-27-2014

Did you closed the work book in your script? (Test1)- we have to close the any work books at the end of the script without fail otherwise you can access them in next script....
Use the UsedRange and get the row where you have enter the data rather hard coding the row numbers.