08-13-2012, 12:54 PM
How can I find whether Microsoft Excel file exists or not using VB Script code in UFT/QTP?
It will be great if I can get a working script.
It will be great if I can get a working script.
|
how to find Excel file exist or not in vbscript code
|
|
08-13-2012, 12:54 PM
How can I find whether Microsoft Excel file exists or not using VB Script code in UFT/QTP?
It will be great if I can get a working script.
Hi,
Below code might help you... Code: set objFSO = createobject("Scripting.FileSystemObject")
objFSO.FileExists("C:\FileFolder\Filename.xls")Veera For checking File not exists you can use the below Code: If not objFSO.FileExists("C:\FileFolder\Filename.xls") then
Your Action...
End if
This is a function library i have written for retrieving the data from an excel sheet.
But whenever i tried to execute the same code i get General Run Error. can anybody suggest me the right answer. Code: Function FindObject(ObjectName)
Set desc=description.Create
For j=1 to datatable.GetSheet("OR1").GetRowCount
datatable.GetSheet("OR1").SetCurrentRow(j)
If datatable("name","OR1")=ObjectName Then
If datatable("micclass","OR1")<>" " Then
desc("micclass").value=datatable("micclass","OR1")
End If
' If datatable("html id","OR1")<>" " Then
' desc("micclass").value=datatable("html id","OR1")
' End If
If datatable("class","OR1")<>" " Then
desc("micclass").value=datatable("class","OR1")
End If
If datatable("innertext","OR1")<>" " Then
desc("micclass").value=datatable("innertext","OR1")
End If
Set obj=Browser("creationtime:=0").page("title:=.*").ChildObjects(desc)
FindObject=obj(0)
'obj1=FindObject(obj)
End If
Next
End FunctionGeneral Run Error Function file: C:\Program Files\HP\QuickTest Professional\Tests\FindObject.vbs Line (29): " FindObject=obj(0)" this is the Error i get whenever i execute the Above code
Hi,
I am getting the below error : when i execute the below code that i have written in Function library. General Run Error Function file: C:\Program Files\HP\QuickTest Pro Code: Function FindObject(ObjectName)
Set desc=description.Create
For j=1 to datatable.GetSheet("OR1").GetRowCount
datatable.GetSheet("OR1").SetCurrentRow(j)
If datatable("name","OR1")=ObjectName Then
If datatable("micclass","OR1")<>" " Then
desc("micclass").value=datatable("micclass","OR1")
End If
' If datatable("html id","OR1")<>" " Then
' desc("micclass").value=datatable("html id","OR1")
' End If
If datatable("class","OR1")<>" " Then
desc("micclass").value=datatable("class","OR1")
End If
If datatable("innertext","OR1")<>" " Then
desc("micclass").value=datatable("innertext","OR1")
End If
Set obj=Browser("creationtime:=0").page("title:=.*").ChildObjects(desc)
FindObject=obj(0)
'obj1=FindObject(obj)
End If
Next
End Function |
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads… | |||||
| Thread | Author | Replies | Views | Last Post | |
| General run error when Exist fails | msacks | 1 | 2,433 |
02-08-2019, 02:12 AM Last Post: Ankur |
|
| how can i click a macro button in excel using vbscript | arpan | 1 | 4,397 |
10-03-2017, 06:27 AM Last Post: supputuri |
|
| [UFT 12.52/VBScript] Test object exist, is visible and enabled before take an action | sparkwanted | 0 | 4,200 |
02-07-2017, 12:28 AM Last Post: sparkwanted |
|
| How to find a file after downloading | UFT_Newbie | 1 | 3,390 |
09-18-2014, 08:43 PM Last Post: UFT_Newbie |
|
| Can any of the line in notepad file be appended/updated/modified via QTP(VBScript)? | rookie_automator | 1 | 2,989 |
08-22-2013, 07:13 AM Last Post: basanth27 |
|