编程语言

img iwebsms

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

发表于2004/9/28 19:14:00  789人阅读

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
阅读全文
0 0

相关文章推荐

img
取 消
img