Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export datastore to excel with pb 8

Status
Not open for further replies.

mmecombe

Programmer
Jan 20, 2005
2
US
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.

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
Thanks!!
 
Yeah, but it didn't seem to work. I ended up creating a new grid datawindow with all the information i needed on it. I think saved that datawindow to an htmlTable which got coverted to native excel using ole.

Thanks for your responce.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top