VBS操作Excel
- 打开excel
Dim objExcel,objWorkbook,objSheet
Set objExcel=CreateObject("excel.application")
Set objBook=objExcel.Workbooks.Open("\\MGPCTFSW01\UserFolders$\t165050\Desktop\Portal_Smoke_Automation\Test Data\Book1.xlsx")
- 读取Excel
a.
Set objSheet=objbook.Sheets("sheet1")
msgbox objSheet.cells(2,2)
Set objBook=Nothing
Set objSheet=Nothing
objExcel.Quit
b.
Set objSheet=objbook.Sheets(SheetName)
Set objRange = objSheet.UsedRange
objRow = objRange.Find(RowName).Row
objColumn = objRange.Find(ColumnName).Column
objValue = objSheet.Cells(objRow,objColumn)
原文地址:https://www.cnblogs.com/AmyHu/p/9168409.html
时间: 2024-10-14 10:05:39