Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Export datastore to excel with pb 8

Export datastore to excel with pb 8

Export datastore to excel with pb 8

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.


If lds_audit_summary.SaveAs(ls_name,HTMLTable!,True) = -1
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)
            end if
            DESTROY excel

RE: Export datastore to excel with pb 8

Did you try SaveAsAscii() function?

RE: Export datastore to excel with pb 8

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close