QTP读取excel的内容
上一篇 /
下一篇 2009-09-05 23:17:49
- ******************************************
- ' ** 函数名:GetCell
- ' ** 输 入:filePath,sheetName,rowNum, colNum
- ' ** filePath --- 文件路径
- ' ** sheetName --- 表名
- ' ** rowNum --- 行号
- ' ** colNum --- 列号或列名
- ' ** 功能描述: 此函数实现取得Excel表中某一单元格值的功能
- '** 调用方法:GetCell("c:\db.xls","Sheet1",1,1)
- 或getcell("c:\db.xls","Sheet1",1,"A")
- '****************************************************
-
- Function GetCell(filePath,sheetName,rowNum,colNum)
-
- Set excObj = createobject("Excel.Application")
- Set excFile = excObj.workbooks.open(filePath)
- Set excSheet = excFile.worksheets(sheetName)
-
- getCell = excSheet.cells(rowNum,colNum) '取单元格的值
-
- End Function
收藏
举报
TAG: