[ABAP] EXCEL OLE2 - Sheet 이동 및 이름 변경

SAPWISE·2024년 6월 11일
report ztest10.
data: application type ole2_object,
       workbook type ole2_object,
       sheet type ole2_object,
       cells type ole2_object,
       gs_chart type ole2_object.
constants: row_max type i value 256.
data index type i.
data : p_file type string.
p_file = 'C:\Users\hj\OneDrive\바탕 화면\Z38PPR077.xlsx'.
create object application 'excel.application'.
set property of application 'visible' = 1.
call method of
    application
    'Workbooks' = workbook.
*CALL METHOD OF workbook 'Add'. "if you want to create a file
call method of
    workbook
    'Open'

  exporting
    #1       = p_file.
*          #1 =    'C:\Temp\XXX0099_Support_20XX.xls'.  "your excel file
**                                                            name here

* Create second Excel sheet  "Timesheets
call method of
    application
    'Worksheets' = sheet
  exporting
    #1           = 2.
set property of sheet 'Name' = 'Timesheets'.
call method of
    sheet
    'Activate'.

이처럼 VBA를 SAP으로 구현하면 EXCEL 활용범위가 아주 넓음
VBA 참조 : https://learn.microsoft.com/ko-kr/previous-versions/office/troubleshoot/office-developer/select-cells-rangs-with-visual-basic

profile
SAP, ERP, ABAP

0개의 댓글