Skip to Content
author's profile photo Former Member
Former Member

Set Left/RightSideVacuum Width to Page of MSWord File Which Created WithOLE

Moderator message: please do not post the same question in more than one forum. Duplicate deleted.

Hi,

i want to set left/right side vacuum width to page of ms word file which created with ole.

How can i change page attributes (page width-height size, page horizontal-vertical direction etc.) of ms word file which created with OLE?

this is my working code;

*-- create word file
DATA: gs_word         TYPE ole2_object ,
      gs_documents    TYPE ole2_object ,
      gs_newdoc       TYPE ole2_object ,
      gs_selection    TYPE ole2_object ,
      gs_application  TYPE ole2_object ,
      gs_actdoc       TYPE ole2_object .
 
  CREATE OBJECT gs_word 'WORD.APPLICATION' .
  IF sy-subrc NE 0 .
    MESSAGE s000(su) WITH 'Error while creating OLE object!'.
    LEAVE PROGRAM .
  ENDIF .
 
  SET PROPERTY OF gs_word 'Visible' = '0' .
  CALL METHOD OF gs_word 'Documents' = gs_documents.
*  CALL METHOD OF gs_documents 'Add' = gs_newdoc.
p_file = l_word_string.
  CALL METHOD OF gs_documents 'OPEN'
EXPORTING
#1 = p_file.
*  call method of gs_newdoc 'Activate' = gs_actdoc.
 
CALL METHOD OF gs_word 'ActiveDocument' = gs_actdoc .
 
GET PROPERTY OF gs_actdoc 'Application' = gs_application .
 
 
  GET PROPERTY OF gs_word 'Selection' = gs_selection.
 
   CALL METHOD OF gs_actdoc 'SaveAs'
    EXPORTING
      #1 = p_file "'C:\file.doc'          "filename
      #2 = 1                      "fileFormat
      #3 = 0                      "LockComments
      #4 = sy-uname             "password to open a workbook
      #5 = 0                      "AddToRecentFiles
      #6 = sy-uname.             "password for write access
 
*CALL METHOD OF gs_actdoc 'PrintOut' .
 
    CALL METHOD OF gs_word 'Quit' .
 
    FREE: gs_word, gs_actdoc, gs_documents , gs_newdoc .
*--

Which the codes in ole can i add into my codes to change page attributes of ms word file?

Can somebody help me pls?

Thanks.

Edited by: Matt on Dec 18, 2008 2:26 PM

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Dec 18, 2008 at 01:27 PM

    Please do not post the same question in more than one forum. Duplicate deleted.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.