Skip to Content

Need to set default zoom in excel in ole

I am preparing one excel sheet through OLE technology. I want my excel should be defaulted the zoom property with 90 percent but currently it is defaulting with 100 % zoom under View tab of excel. Any idea how I can set the default zoom in excel generated through OLE.

Add a comment
10|10000 characters needed characters exceeded

  • If you understand the answer of Mateusz, then you are able to do any Excel action using OLE by simply using the Excel Recorder and its object browser, and converting manually into ABAP.

    The VBA (as given by the recorder):

    ActiveWindow.Zoom = 90

    corresponds to (because you can see in Excel VBA Editor that ActiveWindow and Zoom are properties):

    GET PROPERTY OF lv_excel 'ActiveWindow' = lv_active_window.
    SET PROPERTY OF lv_active_window 'Zoom' = 90.

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jul 13, 2020 at 06:17 AM

    Hello Chiradip Das

    According to this StackOverflow thread zoom is a property of a window. Here is an example, which you should be able to use/translate to ABAP: https://stackoverflow.com/questions/5953703/setting-all-excel-sheets-at-a-defined-zoom-level

    Another example: https://exceloffthegrid.com/vba-code-to-control-excels-zoom-settings/

    Kind regards,
    Mateusz

    Edit: This could work, although I did not check.

    DATA:
      lv_excel TYPE ole2_object,
      lv_active_window TYPE ole2_object.
    
    CREATE OBJECT lv_excel 'EXCEL.APPLICATION'.
    
    GET PROPERTY OF lv_excel 'ActiveWindow' = lv_active_window.
    SET PROPERTY OF lv_active_window 'Zoom' = 80.
    
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 12, 2020 at 06:55 PM

    Hi Das.

    You can search in Google to find the MS Excel Default zoom option, based on your MS office version.

    Regards

    SS

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 13, 2020 at 05:58 AM
    -2

    Thanks for the suggestion. I am generating the excel through ABAP code in OLE methodology.

    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.