11-03-2010, 04:36 PM
Hi Sasi
please check my code, i tried to simulate your error.
1. Function definition:
2. Associate .vbs file in settings >> resources
3. Main script in QTP:
This is working fine for me. can you please check, is it the way you are trying to do? OR am i understanding it other way?
please check my code, i tried to simulate your error.
1. Function definition:
Code:
Public Function ReadExcel()
Set appExcel = CreateObject("Excel.Application")
Set objWorkBook = appExcel.Workbooks.Open ("C:\Documents and Settings\Administrator\Desktop\ActualizedTrades_06Mar10.xls") 'opens the sheet
Set objSheet = appExcel.Sheets("ACTUALIZED_TRADE") ' To select particular sheet
Column_Count=objSheet.usedrange.columns.count
Row_Count=objSheet.usedrange.rows.count
Environment.value("data1")=objSheet.cells(1.1).value
End Function
2. Associate .vbs file in settings >> resources
3. Main script in QTP:
Code:
Call ReadExcel()
MsgBox Environment.Value("data1")
' This line will print the cell data
This is working fine for me. can you please check, is it the way you are trying to do? OR am i understanding it other way?