QTP如何使用Excel对象处理数据
上一篇 /
下一篇 2010-03-30 14:40:36
/ 个人分类:QTP
Dim x1
'打开Excel文件
Function OpenExcelFile(strFilePath)
Set x1 = CreateObject("Excel.Application")
x1.Workbooks.Open strFilePath
End Function
'获得指定单元格数据
Function GetCellData(strSheet,rwIndex,colIndex)
GetCellData = x1.WorkSheets(strSheet).Cells(rwIndex,colIndex)
End Function
'填充单元格数据
Function PutCellData(strSheet,rwIndex,colIndex,varData)
x1.WorkSheets(strSheet).Cells(rwIndex,colIndex) = varData
End Function
'保存并退出
Function SaveAndQuit()
x1.Activeworkbook.save
x1.Quit
Set x1 = nothing
End Function
收藏
举报
TAG: