2009 Jul 20 3:29 AM
Hi Expert,
I need to write data into excel sheet using Excel OLE object, And now I've face the problem that I need to adjust column width of the excel sheet but I don't know how to work with Excel column.
I've record Excel Macro and got below code ..
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 20/7/2009 by AA
'
'
Range("B1").Select
Columns("B:B").ColumnWidth = 21.57
End Sub
How to convert 'Columns("B:B").ColumnWidth = 21.57' to ABAP Code ?
Please give me an advice
Thanks in advance.
Nattapash
2009 Jul 20 3:57 AM
Hi Nattapash Changpant,
Try this Code :
DATA : columns TYPE ole2_object.
CALL METHOD OF excel 'Range' = columns
EXPORTING
#1 = 'A1'
#2 = 'B1'.
set PROPERTY OF columns 'ColumnWidth' = '100'.Regards,
Suneel G
Hi Nattapash Changpant,
Try this Code :
DATA : columns TYPE ole2_object.
CALL METHOD OF excel 'Range' = columns
EXPORTING
#1 = 'A1'
#2 = 'B1'.
set PROPERTY OF columns 'ColumnWidth' = '100'.Regards,
Suneel G
2009 Jul 20 3:57 AM
Hi Nattapash Changpant,
Try this Code :
DATA : columns TYPE ole2_object.
CALL METHOD OF excel 'Range' = columns
EXPORTING
#1 = 'A1'
#2 = 'B1'.
set PROPERTY OF columns 'ColumnWidth' = '100'.Regards,
Suneel G
2009 Jul 20 6:08 AM
Thank you very much Suneel G.
for singel column I use
call METHOD of gs_excel 'Cells' = gs_cell1
exporting
#1 = row_number
#2 = column_number.
call METHOD of gs_excel 'Range' = gs_column
EXPORTING
#1 = gs_cell1
#2 = gs_cell1.
SET PROPERTY OF gs_column 'ColumnWidth' = column_width.
I found ratio of column width of excel is about 5:1 for cm.
So if I want to adjust the width of column to 1 cm, I need to send column_width = 5.
Regards,
Nattapash C.
Edited by: Nattapash Changpant on Jul 20, 2009 7:09 AM
2020 Jul 07 12:13 PM
Hi Suneel,
Can you please help me to convert this below Macro into ABAP code?
ActiveSheet.CheckBoxes.Add(180, 123.5, 33.5, 17.5).Select
Range("B10").Select
Your help will be appreciated!!
Thank you.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |