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

excel 2000 & excel 2003

Former Member
0 Likes
396

dear all,

these code can work at excel 2003 but cant work at excel 2000,pls give me some

help,Thanks so much.

create object g_excel 'EXCEL.APPLICATION'.

CALL METHOD OF g_excel 'Workbooks' = g_WORKBOOK.

CALL METHOD OF g_WORKBOOK 'Add'.

CALL METHOD OF g_excel 'Worksheets' = g_SHEET

EXPORTING #1 = 1.

CALL METHOD OF g_SHEET 'Activate'.

set property of g_excel 'Visible' = '1'.

dear all,

these code can work at excel 2003 but cant work at excel 2000,pls give me some

help,Thanks so much.

create object g_excel 'EXCEL.APPLICATION'.

CALL METHOD OF g_excel 'Workbooks' = g_WORKBOOK.

CALL METHOD OF g_WORKBOOK 'Add'.

CALL METHOD OF g_excel 'Worksheets' = g_SHEET

EXPORTING #1 = 1.

CALL METHOD OF g_SHEET 'Activate'.

set property of g_excel 'Visible' = '1'.

2 REPLIES 2
Read only

Former Member
0 Likes
367

Dear all,

I have resolved it myself, share my experience

for excel 2003

set property of g_excel 'Visible' = '1'. and set property of g_excel 'Visible' = 1.

are same but

for excel 2000

only set property of g_excel 'Visible' = 1

is right.

FYI

Read only

former_member189059
Active Contributor
0 Likes
367

Hello,

This is what i normally do on Excel 2000

  CREATE OBJECT excel 'EXCEL.APPLICATION'.

  IF sy-subrc NE 0.
    WRITE: / 'No EXCEL creation possible'.
    STOP.
  ENDIF.

  SET PROPERTY OF excel 'DisplayAlerts' = 0.
  CALL METHOD OF excel 'WORKBOOKS' = workbook .

* SET PROPERTY OF excel 'VISIBLE' = 1.


* creating workbook
  SET PROPERTY OF excel 'SheetsInNewWorkbook' = 1.
  CALL METHOD OF workbook 'ADD'.

* creating sheets
  DO 3 TIMES.
    IF sy-index GT 1.
      CALL METHOD OF excel 'WORKSHEETS' = sheet.
      CALL METHOD OF sheet 'ADD'.
      FREE OBJECT sheet.
    ENDIF.
  ENDDO.

count = 0.
do 3 times.
  count = count + 1.
  CALL METHOD OF excel 'WORKSHEETS' = sheet
    EXPORTING
    #1 = count.

* setting the initial position of the index sheet
  row = 1.
  col = 1.

* naming and activating the index sheet
  SET PROPERTY OF sheet 'NAME' = count.
  CALL METHOD OF sheet 'ACTIVATE'.