Application Development 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: 

OLE Image

john_wayne
Participant
0 Kudos

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.

5 REPLIES 5

Former Member
0 Kudos
****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")

0 Kudos

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?

0 Kudos

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

Former Member
0 Kudos

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]

Former Member
0 Kudos

http://wiki.sdn.sap.com/wiki/display/Community/InsertPictureImageinExcelusingOLE+Automation

Theres a Wiki regarding this..check this.