怎样将datagrid中数据到处到execl中

发表于:2007-06-30来源:作者:点击数: 标签:
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) exce
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

原文转自:http://www.ltesting.net