Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PB OLE call to Excel

66 views
Skip to first unread message

apan

unread,
Oct 7, 1998, 3:00:00 AM10/7/98
to
Hi everybody,
In our applicaiton, we use OLE call to populate cells in Excel. We do
it one cell at a time right now. The performance is not acceptable. We
thought if we can populate one row at a time, it might improve the
performance so we tried the Range.TextToColumns function. But we can not
find the right syntax. Can anyone help? PB version is 5.0.04 and Excel is
Office 97.
We are also open to any suggestion. Your help is highly appreciated.

The code below is a sample code trying to figure out the syntax of
TextToColumns.

Thank you,
Alex
ap...@ctp.com

oleobject ole_object
long ll_counter

//create a local ole object
Ole_object = create oleobject

//connect the ole object to excel
If ole_object.ConnectToNewObject("excel.application") <> 0 Then
Messagebox("OLE Error","Could not connect to Excel")
Return
End If

//Insert a new book into the spreadsheet
ole_object.workbooks.add()

//add 1 sheet
ole_object.Sheets.Add()

ole_object.application.workbooks(1).worksheets(1).Range("A1").value =
"t1;t2;t2"
ole_object.application.workbooks(1).worksheets(1).Range("A1").TextToColumns(
"A1",True,True,False,False,";",False,False,False,False,False)

// Close workbook
ole_object.application.workbooks(1).Close()

//quit excel
ole_object.application.quit()

//disconnect the object
ole_object.disconnectobject()

//free the memory
destroy ole_object


sm.ol...@gmail.com

unread,
Mar 27, 2014, 4:39:38 AM3/27/14
to
It's not working in PowerBuilder 12.0 and MS Office 2010. Please provide the solution, If you know.
0 new messages