//导出
Private Sub Command5_Click()
If Adodc2.Recordset.RecordCount = 0 Then
MsgBox "没有数据可导出!", vbExclamation, "导出"
Else
MsgBox "将把数据导出到EXCLE里,请稍等.......", vbExclamation, "导出"
Screen.MousePointer = vbHourglass
Dim i As Integer
Dim j As Integer
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.add
Set xlSheet = xlBook.Worksheets(1)
' xlSheet.Cells.Columns. '.AutoFit
Screen.MousePointer = 11
With xlSheet
'EXCLE第一列的宽度
.Columns(1).ColumnWidth = 9.15
.Columns(2).ColumnWidth = 14.13
.Columns(3).ColumnWidth = 14.63
.Columns(4).ColumnWidth = 6.5
.Columns(5).ColumnWidth = 12.5
'字体 边框 居中
.Cells.Font.Size = 9
.Cells(1, 1).Borders.LineStyle = 1 '边框
.Cells(1, 2).Borders.LineStyle = 1
.Cells(1, 3).Borders.LineStyle = 1
.Cells(1, 4).Borders.LineStyle = 1
.Cells(1, 5).Borders.LineStyle = 1
.Cells.HorizontalAlignment = xlCenter
.Cells.WrapText = True '自动换行
.Cells.EntireColumn.AutoFit '行高根据内容自动调整
.Cells.EntireRow.AutoFit
'文件名称
.name = CStr(Date) '时间为名称