Sub Excel_Out_Click()
Dim xlapp As Excel.Application 'Excel对象
Dim xlbook As Excel.Workbook '工作簿
Dim xlsheet As Excel.Worksheet '工作表
Dim i, j As Integer
Set xlapp = CreateObject("Excel.Application") '创建EXCEL对象
'Set xlbook = xlapp.Workbooks.Open(App.Path & "/test.xls") '打开已经存在的test.xls工件簿文件
Set xlbook = xlapp.Workbooks.Add '新建EXCEL工件簿文件
'xlbook.RunAutoMacros (xlAutoOpen) '运行EXCEL启动宏
'xlbook.RunAutoMacros (xlAutoClose) '运行EXCEL关闭宏
xlapp.Visible = True '设置EXCEL对象可见(或不可见)
Set xlsheet = xlbook.Worksheets(1) '设置活动工作表''
xlsheet.Range("A3" & ":" & "A24").Rows.Group
xlsheet.Cells(7, 2) = 2008 '在第二页的第7行第2列写入2008
xlapp.Quit '结束EXCEL对象'xlapp.Workbooks.Close
Set xlapp = Nothing '释放xlApp对象
End Sub
阅读(2521) | 评论(0) | 转发(0) |