<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: OLE - multiple sheets not working? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/ole-multiple-sheets-not-working/m-p/4834494#M1131017</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Twin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I used your code and for me it created 3 sheets with data in the first 2 sheet perfectly fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; The code is working OK&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Rajvansh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Dec 2008 09:15:30 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-12-01T09:15:30Z</dc:date>
    <item>
      <title>OLE - multiple sheets not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ole-multiple-sheets-not-working/m-p/4834493#M1131016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have the following code (below) which should create an excel file containing 3 sheets. It, however, only creates 1 sheet. Any ideas as to why the second and third sheet are not created?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  ZWBEXCEL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INCLUDE ole2incl.&lt;/P&gt;&lt;P&gt;DATA: application TYPE ole2_object,&lt;/P&gt;&lt;P&gt;workbook TYPE ole2_object,&lt;/P&gt;&lt;P&gt;sheet TYPE ole2_object,&lt;/P&gt;&lt;P&gt;cells TYPE ole2_object.&lt;/P&gt;&lt;P&gt;CONSTANTS: row_max TYPE i VALUE 256.&lt;/P&gt;&lt;P&gt;DATA index TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF itab1 OCCURS 0, first_name(10), END OF itab1.&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF itab2 OCCURS 0, last_name(10), END OF itab2.&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF itab3 OCCURS 0, formula(50), END OF itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;************************************************************************&lt;/P&gt;&lt;P&gt;*START-OF-SELECTION&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND: 'Peter' TO itab1, 'Ivanov' TO itab2,&lt;/P&gt;&lt;P&gt;*'=Sheet1!A1 &amp;amp; u201D u201D &amp;amp; Sheet2!A1' TO itab3,&lt;/P&gt;&lt;P&gt;'John' TO itab1, 'Smith' TO itab2.&lt;/P&gt;&lt;P&gt;*'=Sheet1!A2 &amp;amp; u201D u201D &amp;amp; Sheet2!A2' TO itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT application 'excel.application'.&lt;/P&gt;&lt;P&gt;SET PROPERTY OF application 'visible' = 1.&lt;/P&gt;&lt;P&gt;CALL METHOD OF application 'Workbooks' = workbook.&lt;/P&gt;&lt;P&gt;CALL METHOD OF workbook 'Add'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create first Excel Sheet&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL METHOD OF application 'Worksheets' = sheet&lt;/P&gt;&lt;P&gt;EXPORTING #1 = 1.&lt;/P&gt;&lt;P&gt;CALL METHOD OF sheet 'Activate'.&lt;/P&gt;&lt;P&gt;SET PROPERTY OF sheet 'Name' = 'Sheet1'.&lt;/P&gt;&lt;P&gt;LOOP AT itab1.&lt;/P&gt;&lt;P&gt;index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name&lt;/P&gt;&lt;P&gt;CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.&lt;/P&gt;&lt;P&gt;SET PROPERTY OF cells 'Value' = itab1-first_name.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create second Excel sheet&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL METHOD OF application 'Worksheets' = sheet&lt;/P&gt;&lt;P&gt;EXPORTING #1 = 2.&lt;/P&gt;&lt;P&gt;SET PROPERTY OF sheet 'Name' = 'Sheet2'.&lt;/P&gt;&lt;P&gt;CALL METHOD OF sheet 'Activate'.&lt;/P&gt;&lt;P&gt;LOOP AT itab2.&lt;/P&gt;&lt;P&gt;index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name&lt;/P&gt;&lt;P&gt;CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.&lt;/P&gt;&lt;P&gt;SET PROPERTY OF cells 'Value' = itab2-last_name.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create third Excel sheet&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL METHOD OF application 'Worksheets' = sheet&lt;/P&gt;&lt;P&gt;EXPORTING #1 = 3.&lt;/P&gt;&lt;P&gt;SET PROPERTY OF sheet 'Name' = 'Sheet3'.&lt;/P&gt;&lt;P&gt;CALL METHOD OF sheet 'Activate'.&lt;/P&gt;&lt;P&gt;LOOP AT itab3.&lt;/P&gt;&lt;P&gt;index = row_max * ( sy-tabix - 1 ) + 1. " 1 - column name&lt;/P&gt;&lt;P&gt;CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = index.&lt;/P&gt;&lt;P&gt;SET PROPERTY OF cells 'Formula' = itab3-formula.&lt;/P&gt;&lt;P&gt;SET PROPERTY OF cells 'Value' = itab3-formula.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Save excel speadsheet to particular filename&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL METHOD OF sheet 'SaveAs'&lt;/P&gt;&lt;P&gt;EXPORTING #1 = 'c:\temp\exceldoc1.xls'     "filename&lt;/P&gt;&lt;P&gt;#2 = 1.                          "fileFormat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Dec 2008 08:52:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ole-multiple-sheets-not-working/m-p/4834493#M1131016</guid>
      <dc:creator>former_member201275</dc:creator>
      <dc:date>2008-12-01T08:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: OLE - multiple sheets not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ole-multiple-sheets-not-working/m-p/4834494#M1131017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Twin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I used your code and for me it created 3 sheets with data in the first 2 sheet perfectly fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; The code is working OK&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Rajvansh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Dec 2008 09:15:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ole-multiple-sheets-not-working/m-p/4834494#M1131017</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-01T09:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: OLE - multiple sheets not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ole-multiple-sheets-not-working/m-p/4834495#M1131018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok.... weird. &lt;/P&gt;&lt;P&gt;I wonder if there are some setting changes I need to make in Excel itself?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Dec 2008 09:43:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ole-multiple-sheets-not-working/m-p/4834495#M1131018</guid>
      <dc:creator>former_member201275</dc:creator>
      <dc:date>2008-12-01T09:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: OLE - multiple sheets not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ole-multiple-sheets-not-working/m-p/4834496#M1131019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I managed to fix the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In excel I go to Tools-&amp;gt;Options, then under General tab I set 'Sheets in new workbook' to 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way of controlling this when opening the file from Sap, i.e. I may need to create 7 or 8 sheets. Does this mean I have to go and change the setting in excel each time?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Dec 2008 09:59:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ole-multiple-sheets-not-working/m-p/4834496#M1131019</guid>
      <dc:creator>former_member201275</dc:creator>
      <dc:date>2008-12-01T09:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: OLE - multiple sheets not working?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ole-multiple-sheets-not-working/m-p/4834497#M1131020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;solved:&lt;/P&gt;&lt;P&gt;SET PROPERTY OF application 'SheetsInNewWorkbook' = 7.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Dec 2008 10:02:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ole-multiple-sheets-not-working/m-p/4834497#M1131020</guid>
      <dc:creator>former_member201275</dc:creator>
      <dc:date>2008-12-01T10:02:38Z</dc:date>
    </item>
  </channel>
</rss>

