一学就用!最近为硬件部搞测试软件,用VB.NET,需要把测试结果保存到excel文档。
其中某个功能是EXCEL 的单元格需要设置颜色。
Dim oExcel As New Microsoft.Office.Interop.Excel.Application
Dim obook As Microsoft.Office.Interop.Excel.Workbook
Dim oSheet As Microsoft.Office.Interop.Excel.Worksheet
obook = oExcel.Workbooks.Open(Application.StartupPath & "\testrecord.xls")
oSheet = obook.Worksheets(1)
With oSheet
.Range(.Cells(10,7),.Cells(recordindex,18)).Interior.ColorIndex = 33
End With