I am trying to convert the html file to Excel through powerbuilder, here is my
code
String docname
Int li_rtn
docname = "D:\Desktop\COMP_RPT.htm"
if dw_print_new.SaveAs(docname, HTMLTable!, True) = -1 then
MessageBox("Warning", "Unable to export data. Error writing to file!",
Exclamation!)
return
end if
// Convert HTML file to Excel native format
OLEObject excel
excel = CREATE OLEObject
li_rtn = excel.ConnectToObject(docname)
if li_rtn = 0 then
excel.application.DisplayAlerts = FALSE //getting error this code
excel.application.workbooks(1).Parent.Windows(excel.application.workbooks(1).Na
me).Visible = True
excel.application.workbooks(1).saveas(docname, 39)
excel.application.workbooks(1).close()
else
MessageBox("Error","OLE ConnectToObject return code = " +
string(li_rtn),Exclamation!)
end if
DESTROY excel
The above code is not working. It is generate the runtime error "Name not found
to accessing the external object properties".
Is there anyway to avoid this error and to process the html file to excel?
Please let me know if you have any ideas
Thanks
Bojarajan.
---== Posted via the PFCGuide Web Newsreader ==---
http://www.pfcguide.com/_newsgroups/group_list.asp
2.. There are coding examples in the help for ConnectToNewObject and other
OLE methods which should help you
3.. Why are you saving as HTML and then inserting into Excel? Why not SaveAs
an Excel format?
"Bojarajan" <tboja...@gmail.com> wrote in message
news:4964e7fd$1@forums-1-dub...
I manually tried this option it is working fine. First I generate the crosstab
datawindow as Html format then I open the html file and right click there is a
option for Export to Microsoft Excel. It is capturing all the column values as
per the Crosstab datawindow design.
I want to try this option through from PB code.
Thanks
Bojarajan
On 12 Jan 2009 13:02:33 -0800,
in sybase.public.powerbuilder.ole-ocx-activex