将计算结果输出到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