Micro Focus QTP (UFT) Forums
How to read files by location, and not file name - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to read files by location, and not file name (/Thread-How-to-read-files-by-location-and-not-file-name)



How to read files by location, and not file name - eltee - 03-31-2011

Hi,

Currently, I have hardcoded the filenames(OVSource.xls and OVOutput.xml) in the code like:

Code:
Const XMLDataFile = "D:/OVOutput.xml"
Const ExcelDataFile = "D:/OVSource.xls"

Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.async = false
xmldoc.load(XMLDataFile)

Set oExcel = CreateObject("Excel.Application")
oExcel.Visible = false
Set oWBook = oExcel.Workbooks.Open(ExcelDataFile)

......

Is it possible to write code in such a way where the script picks up the available excel file and xml file available in a particular location? In that way, I wouldnt have to worry too much about the filenames.

Thanks in advance,
Liju


RE: How to read files by location, and not file name - basanth27 - 03-31-2011

Very much. Keyword you should be looking for is,
Scripting.filesystemobject