标题:将计算结果输出到excel时出错,无法保存
取消只看楼主
彭林才
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2016-4-18
结帖率:66.67%
已结贴  问题点数:6 回复次数:0 
将计算结果输出到excel时出错,无法保存
将计算结果输出到excel时出错,代码如下

Set xlsApp = CreateObject("Excel.Application")
Set xlsworkbook = xlsApp.Workbooks.Open(App.Path & "\jieguo.xls")
xlsApp.Visible = False
Set xlssheet = xlsworkbook.Worksheets.Item(1)
xlssheet.Cells(1, 1) = "起算数据"
xlssheet.Cells(2, 1) = "已知点坐标"
xlssheet.Cells(3, 1) = "   点名   ": xlssheet.Cells(3, 2) = "    X(m)  ": xlssheet.Cells(3, 3) = "   Y(m)   "
If daoxianType = 1 Then
    For i = 1 To 4
        xlssheet.Cells(i + 3, 1) = yzdm(i): xlssheet.Cells(i + 3, 2) = yzzbx(i): xlssheet.Cells(i + 3, 3) = yzzby(i)
    Next
End If
If daoxianType = 0 Then
    For i = 1 To 2
        xlssheet.Cells(i + 3, 1) = yzdm(i): xlssheet.Cells(i + 3, 2) = yzzbx(i): xlssheet.Cells(i + 3, 3) = yzzby(i)
    Next
End If

xlsworkbook.Save
xlsApp.Quit
Set xlsApp = Nothing
 
搜索更多相关主题的帖子: excel 
2016-04-24 19:57



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-464076-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.420560 second(s), 9 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved