‎2008 Oct 30 5:53 AM
Moderator message: please use a meaningful subject in future
Hi....
I have a code which i want to transfer it into a function module.But its generation some error.I am proving you with the code.
Can you help me out how to make the FM out of it.
It will be very helpful to me.
CODE:
type-pools ole2 .
word declarations
data: application type ole2_object.
data: word type ole2_object.
data: documents type ole2_object.
data: newdoc type ole2_object.
data: actdoc type ole2_object.
data: selection type ole2_object.
data: inlineshapes type ole2_object.
CREATE OBJECT word 'WORD.APPLICATION' .
IF sy-subrc NE 0 .
MESSAGE s000(su) WITH 'Error while creating OLE object!'.
LEAVE PROGRAM .
ENDIF .
GET PROPERTY OF word 'documents' = documents.
CALL METHOD OF documents 'Add' = newdoc.
EXPORTING
#1 = 0.
call method of newdoc 'Activate'.
*--Getting active document handle
GET PROPERTY OF word 'activedocument' = actdoc .
*--Getting applications handle
GET PROPERTY OF word 'Selection' = selection.
*--setting object's visibility property
SET PROPERTY OF word 'visible' = '1' .
GET PROPERTY OF selection 'InlineShapes' = inlineshapes.
insert the picture in default (top left) position
data: h_logo type ole2_object.
data: h_ins_logo type ole2_object.
data: h_logo_left type ole2_object.
data: h_pos_logo type ole2_object.
CALL METHOD OF inlineshapes 'AddPicture' = h_ins_logo
EXPORTING
#1 = 'C:\pic.gif'.
Kind Regards,
‎2008 Oct 30 6:04 AM
It would be helpful if you provided us with details of the error as well!
Also, please use tags around code fragments to keep the formatting.
matt
‎2008 Oct 30 6:19 AM
Hi Matt,
The error is showing 'word' cannot be changed.I dnt understand that.
Kind Regards,