1个回答
展开全部
Option Explicit
Private Sub Command1_Click()
End
End Sub
Private Sub Command2_Click()
Dim xlapp As Object
Dim xlbook As Object
Dim xlsheet As Object
Set xlapp = CreateObject("Excel.Application") '创建EXCEL对象
'Set xlbook = xlapp.Workbooks.Open(App.Path & "\123.xls") '打开已经存在的test.xls工件簿文件
Set xlbook = xlapp.Workbooks.Add
xlapp.Visible = True '设置EXCEL对象可见(或不可见)
'Set xlsheet = xlbook.Worksheets(sheetid) '设置活动工作表''
Set xlsheet = xlbook.Worksheets(1) '设置活动工作表''
xlsheet.SaveAs App.Path & "/test22.xls" '按指定文件名存盘
xlapp.Application.Quit
Set xlapp = Nothing ' 释放引用
Set xlbook = Nothing ' 释放引用
Set xlsheet = Nothing ' 释放引用
End Sub
Private Sub Command1_Click()
End
End Sub
Private Sub Command2_Click()
Dim xlapp As Object
Dim xlbook As Object
Dim xlsheet As Object
Set xlapp = CreateObject("Excel.Application") '创建EXCEL对象
'Set xlbook = xlapp.Workbooks.Open(App.Path & "\123.xls") '打开已经存在的test.xls工件簿文件
Set xlbook = xlapp.Workbooks.Add
xlapp.Visible = True '设置EXCEL对象可见(或不可见)
'Set xlsheet = xlbook.Worksheets(sheetid) '设置活动工作表''
Set xlsheet = xlbook.Worksheets(1) '设置活动工作表''
xlsheet.SaveAs App.Path & "/test22.xls" '按指定文件名存盘
xlapp.Application.Quit
Set xlapp = Nothing ' 释放引用
Set xlbook = Nothing ' 释放引用
Set xlsheet = Nothing ' 释放引用
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询