document->execute_macro

Recently i was assigned to make a report in Excel template using the spreadsheet interface.
i kind of confuse when i need to merge some cells, because i can not find it in any methods of i_oi_spreadsheet.

And then, i just combine between excel macro in method execute_macro.

in excel file, create macro like these codes below
Sub merge(param1 As Long, param2 As Long, param3 As Long, param4 As Long, param5 As Long)
‘param1 = start Row
‘param2 = start Column
‘param3 = end Row
‘param4 = end Column
‘param5 = alignment

Dim rngArea As range

With ActiveSheet
Set rngArea = .range(.Cells(param1, param2), .Cells(param3, param4))
End With

rngArea.Select
With Selection
.HorizontalAlignment = param5
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.merge
End Sub

and then, in ABAP program

if not o_proxy is initial.
call method o_proxy->execute_macro
exporting
macro_string = ‘module1.merge’
param_count = 5
param1 = param1
param2 = param2
param3 = param3
param4 = param4
param5 = param5
importing
error = errors.
endif.

~ by poyay on April 7, 2008.

One Response to “document->execute_macro”

  1. wajajajjaa…..
    kyknya mo mati2an ni di abap
    sampe dibikin blognya

    bagus yo.. :D
    ntar klo di search di om google kan bisa ketauan
    poyay jago abap :)

    hahaa, ga jago koq Ted..tapi amin amin amin :)
    ga sampai mati-matian juga kyaknya :P
    Thx for visiting :)

Leave a Reply