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

using connectToNewObject with excel application

1,123 views
Skip to first unread message

michela

unread,
Jul 22, 2003, 3:17:41 AM7/22/03
to
Hi to all.
I try this code:

oleobject ole_1
ole_1 = create oleobject
ll_ret = ole_1.connectToNewObject("excel.application")
if ll_ret <> 0 then
....
end if
ole_1.WorkBooks.Open(is_path)
ole_1.ActiveWorkbook.SaveAs(is_dir + ls_appo)

But Open function don't work.
Someone can help me, please?
Regards,
Michela

Mike Chamanara

unread,
Aug 6, 2003, 10:30:45 AM8/6/03
to
Try this:

string file_name = 'p:\reports\bookkeeping.xls'
integer result

OLEObject lole_excel

lole_excel = CREATE OLEObject

result = lole_excel.ConnectToNewObject("excel.application")
IF result < 0 THEN
DESTROY lole_excel
MessageBox("Connecting to OLE excel Object Failed","Error: " + String(result))
Return
ELSE
lole_excel.visible = true
lole_excel.workbooks.open(file_name)
lole_excel.disconnectobject()
DESTROY lole_excel
END IF

0 new messages