<?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: CREATE OBJECT h_excel 'EXCEL.APPLICATION'. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-object-h-excel-excel-application/m-p/1994759#M405420</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You assign the file name when you save the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;


data: e_sheet type ole2_object.
data: e_appl  type ole2_object.
data: e_work  type ole2_object.
data: e_cell  type ole2_object.
data: e_wbooklist type ole2_object.

parameters: p_file type localfile default 'C:Test.xls'.

start-of-selection.


* Start the application
  create object e_appl 'EXCEL.APPLICATION'.
  set property of e_appl 'VISIBLE' = 0.

* Open the file
  call method of e_appl 'WORKBOOKS' = e_wbooklist.
  get property of e_wbooklist 'Application' = e_appl .
  set property of e_appl 'SheetsInNewWorkbook' = 1 .
  call method of e_wbooklist 'Add' = e_work .
  get property of e_appl 'ActiveSheet' = e_sheet .
  set property of e_sheet 'Name' = 'Test' .


* Position to specific cell  in  Column 1
    call method of e_appl 'Cells' = e_cell
           exporting
                #1 = 1
                #2 = 1.
* Set the value
    set property of e_cell 'Value' = 'ABC'.




** Close the file
  get property of e_appl 'ActiveWorkbook' = e_work.
  call method of e_work 'SAVEAS'
        exporting
            #1 = p_file
            #2 = 1  .        " Don't ask me when closing
  
  call method of e_work 'close'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Mar 2007 12:24:51 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2007-03-19T12:24:51Z</dc:date>
    <item>
      <title>CREATE OBJECT h_excel 'EXCEL.APPLICATION'.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-object-h-excel-excel-application/m-p/1994758#M405419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need know, what method or property i have to use, for set up the filename by default, for the workbook that i created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2007 11:49:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-object-h-excel-excel-application/m-p/1994758#M405419</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-19T11:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE OBJECT h_excel 'EXCEL.APPLICATION'.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-object-h-excel-excel-application/m-p/1994759#M405420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You assign the file name when you save the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;


data: e_sheet type ole2_object.
data: e_appl  type ole2_object.
data: e_work  type ole2_object.
data: e_cell  type ole2_object.
data: e_wbooklist type ole2_object.

parameters: p_file type localfile default 'C:Test.xls'.

start-of-selection.


* Start the application
  create object e_appl 'EXCEL.APPLICATION'.
  set property of e_appl 'VISIBLE' = 0.

* Open the file
  call method of e_appl 'WORKBOOKS' = e_wbooklist.
  get property of e_wbooklist 'Application' = e_appl .
  set property of e_appl 'SheetsInNewWorkbook' = 1 .
  call method of e_wbooklist 'Add' = e_work .
  get property of e_appl 'ActiveSheet' = e_sheet .
  set property of e_sheet 'Name' = 'Test' .


* Position to specific cell  in  Column 1
    call method of e_appl 'Cells' = e_cell
           exporting
                #1 = 1
                #2 = 1.
* Set the value
    set property of e_cell 'Value' = 'ABC'.




** Close the file
  get property of e_appl 'ActiveWorkbook' = e_work.
  call method of e_work 'SAVEAS'
        exporting
            #1 = p_file
            #2 = 1  .        " Don't ask me when closing
  
  call method of e_work 'close'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2007 12:24:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-object-h-excel-excel-application/m-p/1994759#M405420</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2007-03-19T12:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE OBJECT h_excel 'EXCEL.APPLICATION'.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-object-h-excel-excel-application/m-p/1994760#M405421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this &lt;/P&gt;&lt;P&gt;DATA: o_application TYPE ole2_object,&lt;/P&gt;&lt;P&gt;o_workbook TYPE ole2_object,&lt;/P&gt;&lt;P&gt;o_worksheet TYPE ole2_object,&lt;/P&gt;&lt;P&gt;o_sheet TYPE ole2_object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: p_excel TYPE rlgrap-filename DEFAULT 'C:\Soft\Book1.xls',&lt;/P&gt;&lt;P&gt;p_sheet(30) TYPE c DEFAULT 'Sheet2'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT o_application 'Excel.Application'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD OF o_application 'Workbooks' = o_workbook.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD OF o_workbook 'Open' EXPORTING #1 = p_excel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD OF o_application 'WORKSHEETS' = o_sheet EXPORTING #1 = p_sheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD OF o_sheet 'DELETE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD OF o_workbook 'Save'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD OF o_application 'Save'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FREE OBJECT: o_application, o_workbook, o_worksheet, o_sheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward if useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2007 12:25:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-object-h-excel-excel-application/m-p/1994760#M405421</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-19T12:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: CREATE OBJECT h_excel 'EXCEL.APPLICATION'.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-object-h-excel-excel-application/m-p/1994761#M405422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks very much&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The answers  have been help full for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2007 13:21:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-object-h-excel-excel-application/m-p/1994761#M405422</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-19T13:21:32Z</dc:date>
    </item>
  </channel>
</rss>

