Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OLE EXCEL OPEN PROBLEM

Former Member
0 Likes
2,073

Hi ,

I am uable to open by the following code , I just want to open excel withot any sheets in it.

can anybody help me out.

INCLUDE OLE2INCL.

DATA EXCEL TYPE OLE2_OBJECT.

CREATE OBJECT EXCEL 'Excel.Application'.

SET PROPERTY OF EXCEL 'Visible' = 1.

CALL METHOD OF EXCEL 'WORKBOOKS' = WORKBOOK.

CALL METHOD OF WORKBOOK 'Open' EXPORTING #1 = 'C:\EX1.XLS'.

Thanks,

Shaik.

2 REPLIES 2
Read only

Former Member
0 Likes
722

Hi,

why do you want to use OLE.

You can try this:



      CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
        EXPORTING
          DOCUMENT               = 'C:\EX1.XLS'

Regards, Dieter

Read only

former_member182670
Contributor
0 Likes
722

WORKBOOKS is a property not a method.

INCLUDE ole2incl.
DATA: excel TYPE ole2_object,
      workbook TYPE ole2_object.
CREATE OBJECT excel 'Excel.Application'.
GET PROPERTY OF  excel 'WORKBOOKS' = workbook.
CALL METHOD OF workbook 'Open' EXPORTING #1       = 'C:\book1.XLS'.
SET PROPERTY OF excel 'Visible' = 1.

If you want to open "empty" Excel remove the call of 'Open' method.