日期:2009-07-05  浏览次数:20518 次

1 引入Microsoft Excel 10.0 Object Library
(项目->添加引用->Com)
2 Dim Excelapp As New Excel.Application

Dim Excelbook As Excel.Workbook
Dim Excelsheet As Excel.Worksheet
3 Set Excelbook = Excelapp.Workbooks.Open (App.path & "\工程进度表.xls")
Excelapp.Sheets("sheet1").Select
Set Excelsheet = Excelapp.Sheets("Sheet1")
4 Excelsheet.Cells(2, 1) = ....
5 Excelbook.Save
Excelapp.Visible = True
6 Excelsheet.Columns(i).ColumnWidth = 5.38
Excelsheet.Rows(i).RowHeight = 51
7 Set Excelapp = Nothing
Set Excelbook = Nothing
Set Excelsheet = Nothing