How to export data in DataGrid into Excel

xiaoxiao2021-03-06  58

1 Introduced Microsoft Excel 10.0 Object Library

(Project -> Add Reference -> 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 & "/ engineering schedule .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) .rtowheight = 51

7 set eXcelapp = Nothing

SET ExcelBook = Nothing

SET EXCELSHEET = Nothing

转载请注明原文地址:https://www.9cbs.com/read-112109.html

New Post(0)