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

80酷酷网    80kuku.com

  datagrid|数据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

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: