i have .xls,.txt,.doc files are there (together). i want
find only .xls file among them? how can we write function?

Answers were Sorted based on User's Feedback



i have .xls,.txt,.doc files are there (together). i want find only .xls file among them? how can w..

Answer / uday kumar_anem

Hi,

Please try with this script:

Set fileSysObj=CreateObject("Scripting.FileSystemObject")
folderPath="D:\"
If fileSysObj.folderexists(folderPath) then
Set fileObj=fileSysObj.getfolder(folderPath)
Set fileObjs=fileObj.files
For Each FileName In fileObjs
If FileName.type="Microsoft Excel Worksheet" then
MsgBox("This is the excel file "&FileName.Name)
End if
next
else
MsgBox("Folder does not exist")
End if

Is This Answer Correct ?    5 Yes 0 No

i have .xls,.txt,.doc files are there (together). i want find only .xls file among them? how can w..

Answer / ramchandra patil

Hi,

@Uday Kumar perfect code...its working perfect

Thanks Uday Kumar..



Ramchandra Patil
9699851282

Is This Answer Correct ?    0 Yes 0 No

i have .xls,.txt,.doc files are there (together). i want find only .xls file among them? how can w..

Answer / kamesh

using the extention (.xls) in code..see below code
Here i open the file from mentioned path and read and write
the values on that.


Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\DIM.txt", 1, True) ' open to
empty file and also use for open the file which is already
created
WriteLineToFile = f.ReadAll 'Read all the file line to
line
msgbox WriteLineToFile

Set MyFile1 = fso.CreateTextFile
("c:\kamesh.txt",True) 'create new empty file
MyFile1.WriteLine WriteLineToFile ' Write all the stuf
in created file
MyFile1.Close

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More QTP Interview Questions

Explain the types of object repositorys in qtp?

0 Answers  


hi all need one help . i want scroll down and up but thing the holl page is taking webtable. i need to scroll down and up using scroll tab any bodu knows plz help its urjent regards balaji

5 Answers  


I hav installed QTP8.2, im working on webapplication, while running the script giving error msg like "QTPro.exe generated errors and will be closed by windows. You will restart the program. An error log is being created". Pls anybody what is the problem, what i have to do for this? Thanks...

0 Answers  


Hi, I am new to QTP and vb.script.How to start to write vb.script in QTP? Please give me suggestions?

3 Answers  


Hi All, we are using QTP Automation Scripts to test SAP. I recorded QTP Automation Scripts in English-based SAP GUI. Now we have to test a French-based SAP sytem and use the same scripts. The QTP scripts are failing when executed on the French-based SAP System due to Object Recognition Issues. What can we do? Do I re-record the scripts in the French-based SAP system?

0 Answers  






How to make arguments optional in a function?

1 Answers   Crea,


How do u override the meaning of a standard object in QTP?

1 Answers  


Please explain me i am using QTP 9.5 ,i am creating re usable scripts,i have to pass data from one local sheet to another local sheet.for example i am creating emploee information, (data is in action 2 local sheet),In this data table emplyeee number will get,i have to pass employee number to another reusable script search data (action2 local data sheet)

2 Answers  


Hi all , I am new at QTP I want a sample script to check validation messages(For java script or VB script) for login page with for web based application.. Any one can Help. I have to complete it in two days I need urgent help.. Ex. if I want to check mail.yahoo.com 1 > If user doed not exist it display "Username does not exist" 2> if invalid Uname and password then it display" Invalid Uname or pass" 3> Loing Sucssessfully. I want to check this types of application by using data table to give values of username and password.. Thanks

2 Answers  


If i entered 2 columns and 4 rows inputs in DDT Like Mango fruit, Banana Fruit, Brinjal Veget, Carrot Veget.. . My Q is How to get the 2nd column value for corresponding 1 column input in 3rd row ie, ( i need to get "veget" in messge box @ run time

5 Answers   CTS,


hi This is Harish.1. What is object repositery .2. what is frame works in QTP,what is keyword driven frame work,explain it and how to associate the folders.3.the build is developed in java, can we write scripting in vb .4.what is discriptive progaram,how to write it.5.what is process of QTp testing.6. how to associate the shared repository. 7.what is implicit and explicit 8.what is runtime data please replay me regards Harish

3 Answers   Syntel,


How to find Operating system information using QTP script?

0 Answers  


Categories