挺简单的,给你一段代码
Dim I, j As Integer
Dim strSource, strDestination As String
strSource = App.Path & "\day.xls" '\data.dat"
Dim xlFile As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
On Error Resume Next
Set xlFile = GetObject(, "Excel.Application")
If Err.Number <> 0 Then
Err.Clear '如果发生错误则要清除 Err 对象。
Set xlFile = CreateObject("Excel.Application")
End If
If xlFile Is Nothing Then
MsgBox "请检查是否安装microsoft EXCELL软件"
Exit Sub
End If
Set xlWorkBook = xlFile.Workbooks.Open(App.Path & "\day.xls")
If xlWorkBook Is Nothing Then
MsgBox "程序运行出现错误"
Exit Sub
End If
Set xlSheet = xlWorkBook.Worksheets("Sheet1")
xlFile.Visible = True
xlFile.Sheets("Sheet1").Select
'将flex1中数据转到数组中,准备输出
Dim data() As String
'data数组赋值
xlSheet.Range("A7:O35").Value = data
xlSheet.Application.SaveWorkspace
xlWorkBook.Close False
xlFile.Quit
温馨提示:答案为网友推荐,仅供参考