01-05-2011 2:40 AM
Does anyone here know how to add images to excel file using OLE classes? Im only interested in getting images from the server not from the local server. Your help is appreciated.
01-05-2011 6:47 AM
****INITIATE EXCEL
* Create object Excel
create object go_excel 'EXCEL.APPLICATION'.
set property of go_excel 'Visible' = 0.
* Create workbook object
call method of go_excel 'WORKBOOKS' = go_workbook .
go_workbook.ActiveSheet.range("B9").Select
go_workbook.ActiveSheet.Pictures.Insert(/sap/picture/picture.bmp")
01-05-2011 6:54 AM
gs_wbooklist.ActiveSheet.range("B9").Select
gs_wbooklist.ActiveSheet.Pictures.Insert(/sap/picture/picture.bmp")
this 2 lines are vb codes how am i going to use it witin abap?
01-05-2011 7:01 PM
Hi,
this is SAP code not VB code.
I am calling VB method from SAP.
I am sending you more data around it to understand.
data: go_excel type ole2_object,
Go_CELL TYPE OLE2_OBJECT,
go_workbooks TYPE OLE2_OBJECT,
go_workbook TYPE OLE2_OBJECT,
go_sheet type OLE2_OBJECT,
go_application type OLE2_OBJECT,
go_activesheet type OLE2_OBJECT,
go_text type OLE2_OBJECT,
go_picture type OLE2_OBJECT,
go_select type OLE2_OBJECT.
****INITIATE EXCEL
Create object Excel
create object go_excel 'EXCEL.APPLICATION'.
set property of go_excel 'Visible' = 0.
Create workbook object
call method of go_excel 'WORKBOOKS' = go_workbook .
Add workbook
call method of go_workbook 'Add' = go_workbook.
*Activate worksheet
call method of go_excel 'Worksheet' = go_activesheet.
*Get active sheet Picture object
get property of go_activesheet 'Pictures' = go_picture.
call method of go_picture 'Insert'
#1 = '<\file path app server>'.
call method of go_excel 'Range' = go_cell
exporting #1 = 'B9'
exporting #2 = 'B9'
cal method go_cell "select' = go_select.
Thank you
Jan
01-05-2011 7:01 AM
Did you get a chace to check this Wiki by Gary Almeida on:
[Insert Picture Image in Excel using OLE Automation|https://wiki.sdn.sap.com/wiki/display/Community/Insert%20Picture%20Image%20in%20Excel%20using%20OLE%20Automation]
01-05-2011 7:02 AM
http://wiki.sdn.sap.com/wiki/display/Community/InsertPictureImageinExcelusingOLE+Automation
Theres a Wiki regarding this..check this.