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

How to use descriptive programming?

0 Answers  


Can i get a simple example exercise for update run mode for sample flight application......... In qtp when i try to run the test in update mode.. Auotmation> update option is disabled............ Pls let me know ................. Thanks in advance.....

3 Answers  


What is the use of Accessibility check point?

3 Answers  


What is the use of virtual objects?

1 Answers  


how to test load test and block box testing an a web based application pls give ans briefly

0 Answers   Impiger,


How to use debug tools?

0 Answers  


what is reusable action and how the same can be implemented (process)?

2 Answers  


what is error and fault in terms of software quality?

0 Answers   TCS,


What is a quick test professional?

0 Answers  


can any one explain with an example how to test Web application using qtp

3 Answers  


How to add Dynamic Objects to Object repository?

5 Answers  


How do you handle multiple banners(at the top the page, the banner is scrolling) in a web page(Dont take the name property(regular expression))

0 Answers   CFC, iton,


Categories