Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Run time- working with external data sheet
#1
Not Solved
Run time- working with external data sheet
Hi Everybody,

1)Can any body suggest a proper method of storing and retrieving values from external excel sheet during run time.

2) And also proper syntax to pass file path as a parameter in calling function.

'I am using function below

Code:
ExternalData(C:\book1,Global)


ExternalData(FilePath,Strsheetname)
Dim appExcel
Set appExcel = CreateObject("Excel.Application)
Set Objbook= appExcel.Workbooks.Open(Strsheetname)
Set objsheet = appExcel.Sheets(Strsheetname)
--
'Here I count the rows and trying to use string compare function
------


appExcel.quit


a) I keep on getting syntax error in the called function (Expected ")" statement)

and if I change the syntax to path ExternalData "<C:\book1>","<Global>" The file does not Exist. What is the proper syntax for passing the file path as a parameter to the function.
Reply
#2
Not Solved
Hi,

Use the following syntax.
Code:
Datatable.Importsheet("filepath"),"sourcesheet","destinationsheet"
Reply
#3
Not Solved
Hi
I used ExternalData("C:\book1","Global") and also the above syntax. it works fine
however one problem

When I tried to save an excel file and the file is already exists at the location. Then an alert comes "File is already exists, Do you want to replace it?" with button "Yes | No | Cancel". Then I am to choosing option manually, I can close that pop up using QTP.

but is there any method to clear all the excel cells, so that Excel Pop-up to save does not come at all.
Reply
#4
Not Solved
During run time you can import the data to the data table and then on completion of the work you can export the data to excel file.
Datatable.Importsheet filename,srcsheet,datatablesheetname
Datatable.Export filename

if the data is already availabe in the file, it would be over written.
Reply
#5
Not Solved
When ever you are importing or exporting data in excel files, you should not kept the file as opned. Otherwise it will through error message
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to create List box in excel sheet at Run time with values yes No JACKSPARROW 0 1,707 01-17-2017, 11:05 AM
Last Post: JACKSPARROW
  HI, i'm having a run time error ,please help? Awzar 0 2,633 01-24-2015, 06:52 AM
Last Post: Awzar
  Loading objects in qtp at run time nitin 0 2,415 12-03-2013, 09:11 PM
Last Post: nitin
  data sheet row count rushil 2 7,661 12-07-2012, 03:10 AM
Last Post: rushil
  Run time error RPS_QTP 1 2,462 10-04-2012, 01:57 PM
Last Post: krr

Forum Jump:


Users browsing this thread: 2 Guest(s)