I'm using Powerbuilder 8 and I'm trying to save a datastore to an excel file. This datastore consists of a freeform datawindow that contains header information and a detail report (separate datawindow). When I use the SaveAs function all I get is header information but the detail information is not displayed or populated. Also, only the html document is created. The excel spreadshee that I try to create from the html fails. I get the error code of -7 (No such file or unable to connect with file) when I call connectToObject. The datastore prints out fine. Why does SaveAs display something different from whats printed and how can I access whats printed and save to a file?
Any help you can provide me would be greatly appreciated.
Thanks!!
Any help you can provide me would be greatly appreciated.
Code:
If lds_audit_summary.SaveAs(ls_name,HTMLTable!,True) = -1
Then
messageBox("Warning", "Unable to export data. Error writing to file",Exclamation!)
end if
// Convert HTML file to Excel native format
OLEObject excel
excel = CREATE OLEObject
ll_rtn = excel.ConnectToObject(ls_name)
if ll_rtn = 0 Then
excel.application.DisplayAlerts = FALSE
excel.application.workbooks(1).Parent.Windows(excel.application.workbooks(1).Name).Visible = True
ll_rtn = excel.application.workbooks(1).saveas(ls_name,60)
excel.application.workbooks(1).close()
end if
DESTROY excel