Can't import data from XL | Pl help!

62 views
Skip to first unread message

Ashfaque

unread,
Dec 27, 2012, 1:41:23 AM12/27/12
to qtp-ele...@googlegroups.com
Hi team/ Karthik:

We are working with prerecorded video 04-08 DDF, where we are being taught how to use data tables. We are independently working on QTP, closely following what Karthik is teaching.
However, while we managed to create a DataPage, it won't import data (see command script in boldface below! Though it Passes. Here's the code below. Thanks in advance for your help..

-Ashfaque

Option Explicit
Dim vCost, vEndMiles, vStartMiles, vGallons, vMile_Gallon
Dim vURL
Dim myP1, myP2
Dim xlPath, xlSheet

vCost = 4
vEndMiles = 90000
 vStartMiles =58000
 vGallons = 500
 xlPath = "C:\Documents and Settings\Administrator\Desktop\QTP Files\12-26_04-08_DDF Excel Sheet.xls"
xlSheet = "TestData"
' Add new DT
'datatable.AddSheet "dTD" 
dataTable.AddSheet "dTD1"

'Import our XL into DT
datatable.ImportSheet xlPath, xlSheet, "dTD1"
'Read the values from the DT
'Perform the activites'
'Modify the results
' Export the DT






'Browser("IE").Page("Page 1").WebEdit("EndMiles").Set vEndMiles
'Browser("IE").Page("Page 1").WebEdit("StartMiles").Set vStartMiles
'Browser("IE").Page("Page 1").WebEdit("Cost").Set vCost
'Browser("IE").Page("Page 1").WebEdit("Mile_Gallons").Set vGallons

Systemutil.Run("iexplore.exe"), vURL
Set myP1 = Browser("IE").Page("Page 1")
myP1.WebEdit("EndMiles").Set vEndMiles
myP1.WebEdit("StartMiles").Set vStartMiles
myP1.WebEdit("Cost").Set vCost
myP1.WebEdit("Mile_Gallons").Set vGallons
myP1.Image("Calculate").Click
wait 5
Set myP2 = Browser("IE").Page("Page2")
vMile_Gallon = myP2.WebElement("MGallon").GetROProperty("innerhtml")
print "The miles per gallon is " & vMile_Gallon


Ashfaque Swapan

unread,
Dec 27, 2012, 2:27:04 AM12/27/12
to qtp-ele...@googlegroups.com
I figured it out. I had misspelled the xlSheet value. Sorry about this.




--
You received this message because you are subscribed to the Google Groups "QTP eLearn Team" group.
To unsubscribe from this group, send email to qtp-elearn-te...@googlegroups.com.
Visit this group at http://groups.google.com/group/qtp-elearn-team?hl=en-US.
 
 



--
Ashfaque Swapan
Phone: (510) 356-6168

Staff reporter,
India-West newspaper
933 MacArthur Blvd
San Leandro, CA 94577.

www.indiawest.com
Reply all
Reply to author
Forward
0 new messages