请看我的ACCESS数据转换为EXCEL的代码哪里错了?
怎么点击“转换”按钮时,怎么转换不起来呢?
我是转贴别人的代码,稍作修改而成!
“转换”按钮代码如下:
appdisk = Trim(App.Path)
If Right(appdisk, 1) <> "\" Then appdisk = appdisk & "\"
Dim lRow As Long
Dim sXLSPath As String
Dim MyExcel As New Excel.Application
Dim MyBook As Excel.Workbook
Dim MySheet As Excel.Worksheet
Dim s As String
Dim i As Integer
Dim j As Integer
Screen.MousePointer = 11
sXLSPath = appdisk & "gcjs.xls"
Open sXLSPath For Output As #1
Close #1
Set MyExcel = CreateObject("excel.application")
Set MyBook = MyExcel.Workbooks.Open(sXLSPath)
Set MySheet = MyExcel.ActiveSheet
MySheet.Range("A1:O1").Select
With MyExcel.Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
End With
MySheet.Columns("A:C").NumberFormat = "0_ "
MySheet.Columns(1).ColumnWidth = 5
。。。
。。。
MySheet.Cells(1, 1) = "K(常数)"
MySheet.Cells(2, 1) = 100 。。。
。。。
For i = 2 To rst.Fields.Count
For j = 2 To rst.RecordCount
MySheet.Cells(j, i).Value = rst.Fields(i - 1).Value
Next j
Next i
具体请看附件!
谢谢!