PB中,数据以excel形式导出报错
OLEObjectole_object,ole_workbooksole_object=CREATEOLEObjectIFole_object.ConnectToNewO...
OLEObject ole_object,ole_workbooks
ole_object=CREATE OLEObject
IF ole_object.ConnectToNewObject("Excel.Application")<>0 then
messagebox('OLE错误','OLE无法连接!')
return
end if
ole_object.workbooks.add
ole_object.Visible=True
ole_workbooks=ole_object.Worksheets(1)
ole_workbooks.cell(1,1).value="分工"
ole_workbooks.cell(1,2).value="顺序"
ole_workbooks.cell(1,3).value="步骤"
ole_workbooks.cell(1,4).value="机器"
ole_workbooks.cell(1,5).value="开始时间"
ole_workbooks.cell(1,6).value="结束时间"
long l_row
for l_row=2 to dw_1.rowcount()
ole_workbooks.cell(l_row,1).value=dw_1.getitemstring(l_row,1)
ole_workbooks.cell(l_row,2).value=dw_1.getitemstring(l_row,2)
ole_workbooks.cell(l_row,3).value=dw_1.getitemstring(l_row,3)
ole_workbooks.cell(l_row,4).value=dw_1.getitemstring(l_row,4)
ole_workbooks.cell(l_row,5).value=dw_1.getitemstring(l_row,5)
ole_workbooks.cell(l_row,6).value=dw_1.getitemstring(l_row,6)
next
ole_workbooks.SaveAs("d:\data.xls")
ole_object.quit()
ole_object.disconnectobject()
destroy ole_object
destroy ole_workbooks
报错提示是:
求大神指导 展开
ole_object=CREATE OLEObject
IF ole_object.ConnectToNewObject("Excel.Application")<>0 then
messagebox('OLE错误','OLE无法连接!')
return
end if
ole_object.workbooks.add
ole_object.Visible=True
ole_workbooks=ole_object.Worksheets(1)
ole_workbooks.cell(1,1).value="分工"
ole_workbooks.cell(1,2).value="顺序"
ole_workbooks.cell(1,3).value="步骤"
ole_workbooks.cell(1,4).value="机器"
ole_workbooks.cell(1,5).value="开始时间"
ole_workbooks.cell(1,6).value="结束时间"
long l_row
for l_row=2 to dw_1.rowcount()
ole_workbooks.cell(l_row,1).value=dw_1.getitemstring(l_row,1)
ole_workbooks.cell(l_row,2).value=dw_1.getitemstring(l_row,2)
ole_workbooks.cell(l_row,3).value=dw_1.getitemstring(l_row,3)
ole_workbooks.cell(l_row,4).value=dw_1.getitemstring(l_row,4)
ole_workbooks.cell(l_row,5).value=dw_1.getitemstring(l_row,5)
ole_workbooks.cell(l_row,6).value=dw_1.getitemstring(l_row,6)
next
ole_workbooks.SaveAs("d:\data.xls")
ole_object.quit()
ole_object.disconnectobject()
destroy ole_object
destroy ole_workbooks
报错提示是:
求大神指导 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询