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

what are SetToProperty, SetROProperty,GetToproperty scripting?

2 Answers  


Did u use check points during ur work experience ?

3 Answers   FedEx,


what is a test strategy & what is the difference between test strategy & test plan?

5 Answers  


If a object property is changed in the application. where it should be updated in QTP... Pls anybody can give the answer.. Thanks in advance...

4 Answers   Navis,


Give me some scripts for 1). checking webpage links (counting links,opening web pages,counting child elements)

2 Answers   CIL,






Hi All As per the requirements i have to copy the data from word document to excel sheet using the QTP Note : Data in word document is in tabular format i.e there is 80 rows and 5 columns table Can any body provide code for this ? Thanks in advance Regards Test123Test

1 Answers  


Can you list some technologies that support qtp?

0 Answers  


How to handle the exceptions using recovery scenario manager In QTP?

2 Answers  


what is error and fault in terms of software quality?

0 Answers   TCS,


how do u handle an object without name using QTP 9.2?

0 Answers   CTS,


I opened gmail login into gmail and i have to save (Pass or move) all the mail into notepad please give me code Thanks of all

0 Answers   Wipro,


In a web page when we enter the city name corresponding zip code is coming in the required field.Can any one please write how to test using QTP,whether this code is coming from Database or not.

1 Answers  


Categories