怎样使用vb创建excel文件
1个回答
展开全部
测试成功,原码:
Dim xlapp As Excel.Application 'Excel对象
Dim xlbook As Excel.Workbook '工作簿
Dim xlsheet As Excel.Worksheet '工作表
Dim xlrange As Excel.range
Private Sub Command1_Click()
Set xlapp = CreateObject("excel.application") '第一层
Set xlbook = xlapp.Workbooks.Add
xlapp.Visible = True
xlbook.sheets(1).range("a1") = "新建成功"
xlbook.SaveAs App.Path & "/测试.xls"
xlbook.Close
End Sub
Dim xlapp As Excel.Application 'Excel对象
Dim xlbook As Excel.Workbook '工作簿
Dim xlsheet As Excel.Worksheet '工作表
Dim xlrange As Excel.range
Private Sub Command1_Click()
Set xlapp = CreateObject("excel.application") '第一层
Set xlbook = xlapp.Workbooks.Add
xlapp.Visible = True
xlbook.sheets(1).range("a1") = "新建成功"
xlbook.SaveAs App.Path & "/测试.xls"
xlbook.Close
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询