TA的每日心情 | 奋斗 2015-3-30 15:24 |
---|
签到天数: 3 天 连续签到: 1 天 [LV.2]测试排长
|
8#
楼主 |
发表于 2013-9-16 11:38:10
|
只看该作者
我贴脚本出来吧
Function getCellValue(ByVal filepath,ByVal columnname,ByVal columnValue,ByVal columnum)
'' Err = 0
' On Error Resume Next
createExcel excelApp,oWorkbook,oSheet,filepath,"Sheet1"
M = oSheet.UsedRange.Count'统计含有数据单元格
' msgbox M
Set oCell = oSheet.Range(columnname & M).Find(columnvalue)'查找功能点编号为ModuleCade单元格
If oCell Is Nothing Then
GetDataCoordinate = "Not Found"
Else
rnum = oCell.Row
getCellValue = oSheet.cells(rnum,columnum)
End if
CloseExcel excelApp,oWorkbook,oSheet
End Function
Function getRowCount(excelPath)
Set excelApp = CreateObject("excel.application")
Set oWorkbook = excelApp.Workbooks.Open(excelPath)
Set oSheet = excelApp.Sheets.Item(1)
getRowCount = oSheet.UsedRange.Rows.Count
CloseExcel excelApp,oWorkbook,oSheet
End Function
Function createExcel(excelApp,oWorkbook,oSheet,filepath,oSheetName)
set excelApp = CreateObject("excel.application")
set oWorkbook = excelApp.Workbooks.Open(filepath)
' set oSheet = excelApp.Sheets.Item(1)
set oSheet =oWorkbook.Worksheets(oSheetName)
End function
Function CloseExcel(excelApp,oWorkbook,oSheet)
excelApp.Quit()
set oSheet = Nothing
set oWorkbook = Nothing
set excelApp = Nothing
End function |
|