<?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: How to translate excel macro code for chart object to AbAp code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-translate-excel-macro-code-for-chart-object-to-abap-code/m-p/12804176#M2025145</link>
    <description>&lt;P&gt;From the VBA code, you can translate into ABAP, you just need to understand a very simple logic to go from VBA to ABAP.&lt;/P&gt;&lt;P&gt;You have several posts which explain the logic or propose examples:&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2012/03/29/using-ole2-objects-for-create-an-excel-file/"&gt;Using ole2 objects to create an excel file | SAP Blogs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/5451194/ole-uploading-excel-file-containing-ole-objects-in.html"&gt;OLE Uploading Excel file containing ole objects in worksheet | SAP Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/7070971/merge-table-cells-in-ms-word-ole-objects.html"&gt;Merge table cells in MS Word - OLE objects | SAP Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/12639163/ms-outlook-ole2.html"&gt;MS Outlook &amp;amp; OLE2 | SAP Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/287201/como-eliminar-filas-vacias-en-ole-abap.html"&gt;How to eliminate empty rows in ole abap? | SAP Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2012/05/15/copying-data-from-microsoft-excel-to-abap-using-ole/"&gt;Copying data from Microsoft Excel to ABAP using OLE | SAP Blogs&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jul 2023 12:56:39 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2023-07-26T12:56:39Z</dc:date>
    <item>
      <title>How to translate excel macro code for chart object to AbAp code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-translate-excel-macro-code-for-chart-object-to-abap-code/m-p/12804172#M2025141</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;
  &lt;P&gt;Somehow I can't really find any documentation on how to translate excel macro code for chart object to ABAP code.&lt;/P&gt;
  &lt;P&gt;I appreciate if anyone can share any link to the translation guide or help me in translating the code below into ABAP code.&lt;/P&gt;
  &lt;P&gt;Here is the excel macro I wanted to translate ( which is to apply data label to stacked bar char, and to apply color to bar of each series; in my case, there are 3 series and I wanted to change each series color )&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;    ActiveSheet.ChartObjects("Chart 1").Activate
    ActiveChart.SetElement (msoElementDataLabelNone)
    ActiveChart.SetElement (msoElementDataLabelCenter)
    ActiveChart.SetElement (msoElementDataLabelNone)
    ActiveChart.SetElement (msoElementPrimaryValueAxisTitleAdjacentToAxis)
    ActiveChart.SetElement (msoElementPrimaryValueAxisTitleNone)
    ActiveChart.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
    ActiveChart.SetElement (msoElementDataLabelCenter)
    ActiveChart.SetElement (msoElementDataTableWithLegendKeys)
    ActiveChart.SetElement (msoElementDataTableNone)
    ActiveChart.ApplyDataLabels
    ActiveChart.FullSeriesCollection(1).DataLabels.Select
    ActiveChart.FullSeriesCollection(1).Select
    ActiveChart.FullSeriesCollection(3).Select
    With Selection.Format.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(0, 176, 240)
        .Solid
    End With
    With Selection.Format.Fill
        .Visible = msoTrue
        .ForeColor.ObjectThemeColor = msoThemeColorAccent1
        .ForeColor.TintAndShade = 0
        .ForeColor.Brightness = 0
        .Transparency = 0
        .Solid
    End With
    ActiveChart.FullSeriesCollection(2).Select
    With Selection.Format.Fill
        .Visible = msoTrue
        .ForeColor.ObjectThemeColor = msoThemeColorAccent6
        .ForeColor.TintAndShade = 0
        .ForeColor.Brightness = -0.25
        .Transparency = 0
        .Solid
    End With&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I did some attempt to apply the data label; although it show the label, but it disrupt the proses of the chart activation causing the chart object failed to be moved to source data sheet. Meanwhile, my attempt to change the color of fullseriescollection(index) failed.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;  GET PROPERTY OF gs_application 'Charts' = gs_charts .
  CALL METHOD OF gs_charts 'Add' = gs_chart .
  CALL METHOD OF gs_chart 'Activate'.
  CALL METHOD OF gs_chart 'SetSourceData'
    EXPORTING
      #1 = gs_cells
      #2 = 1.
  SET PROPERTY OF gs_chart 'ChartType' = p_ch_type .
  SET PROPERTY OF gs_chart 'HasTitle' = p_title.
  SET PROPERTY OF gs_chart 'HasLegend' = p_legend.

  SET PROPERTY OF gs_chart 'ApplyDataLabels' = 'X'.&lt;BR /&gt;  &lt;BR /&gt;  CALL METHOD OF gs_excel 'WorkSheets' = gs_activesheet
    EXPORTING #1 = gv_sheet_name.
  CALL METHOD OF gs_activesheet 'Activate' .
  CALL METHOD OF gs_chart 'Location'
    EXPORTING
      #1 = 2
      #2 = gv_sheet_name.&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Image 1: excel file run smoothly without the syntax set property of 'ApplyDataLabels'&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2184869-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;Image 2 &amp;amp; 3: excel file stuck on the sheet of chart object with the syntax set property of 'ApplyDataLabels', failed to be moved to source data sheet ( although the data label is active )&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2184870-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2184871-image.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 08:26:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-translate-excel-macro-code-for-chart-object-to-abap-code/m-p/12804172#M2025141</guid>
      <dc:creator>xiswanto</dc:creator>
      <dc:date>2023-07-21T08:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to translate excel macro code for chart object to AbAp code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-translate-excel-macro-code-for-chart-object-to-abap-code/m-p/12804173#M2025142</link>
      <description>&lt;P&gt;*Update 25.07.2023&lt;/P&gt;&lt;P&gt;I found the way to apply data label in chart.&lt;/P&gt;&lt;P&gt;However, I've still looking for way to update the color of each series in the chart. I do find out how to get the property of series until the part 'Selection.Format.Fill' and I am sure of it until this part, reason is because I could update the 'Visible' property which is below 'Fill' property. But weirdly enough, I tried to get the 'ForeColor' property, then I tried to set the 'RGB' property under 'ForeColor' (a.k.a. ForeColor.RGB) but it failed to do so using both 'set property of' and 'call method of', such as below passed value&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;SET PROPERTY OF gs_fullseries_c 'RGB' = 'RGB(255, 0, 0)'.&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I also tried to set another property 'ObjectThemeColor' under 'ForeColor' (a.k.a. ForeColor.ObjectThemeColor) but this one run without any problem using such code as below&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;SET PROPERTY OF gs_fullseries_c 'ObjectThemeColor' = 5.&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Please help suggest how do I fix the code.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 07:14:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-translate-excel-macro-code-for-chart-object-to-abap-code/m-p/12804173#M2025142</guid>
      <dc:creator>xiswanto</dc:creator>
      <dc:date>2023-07-25T07:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to translate excel macro code for chart object to AbAp code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-translate-excel-macro-code-for-chart-object-to-abap-code/m-p/12804174#M2025143</link>
      <description>&lt;P&gt;Could you please record the VBA code corresponding to what you want to do, make sure the VBA code works, and post it here?&lt;/P&gt;&lt;P&gt;It's easy to translate then... (without need to understand what does the VBA code)&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 08:39:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-translate-excel-macro-code-for-chart-object-to-abap-code/m-p/12804174#M2025143</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-07-25T08:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to translate excel macro code for chart object to AbAp code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-translate-excel-macro-code-for-chart-object-to-abap-code/m-p/12804175#M2025144</link>
      <description>&lt;P&gt; &lt;SPAN class="mention-scrubbed"&gt;sandra.rossi&lt;/SPAN&gt; sorry, I never heard the VBA code term before, did a quick search, perhaps this below is the VBA code? &lt;/P&gt;&lt;P&gt; I obtained it from the macro recording I created. (tested it on Microsoft Visual Basic for Application and it works as intended).&lt;/P&gt; 
&lt;PRE&gt;&lt;CODE&gt;Sub Macro1()
'
' Macro1 Macro
'

'
    Range("B1").Select
    ActiveCell.FormulaR1C1 = "Col 1"
    Range("C1").Select
    ActiveCell.FormulaR1C1 = "Col 2"
    Range("D1").Select
    ActiveCell.FormulaR1C1 = "Col 3"
    Range("E1").Select
    ActiveCell.FormulaR1C1 = "Col 4"
    Range("A2").Select
    ActiveCell.FormulaR1C1 = "Row 1"
    Range("B2").Select
    ActiveCell.FormulaR1C1 = "5"
    Range("C2").Select
    ActiveCell.FormulaR1C1 = "7"
    Range("D2").Select
    ActiveCell.FormulaR1C1 = "9"
    Range("E2").Select
    ActiveCell.FormulaR1C1 = "11"
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "Row 2"
    Range("B3").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("C3").Select
    ActiveCell.FormulaR1C1 = "5"
    Range("D3").Select
    ActiveCell.FormulaR1C1 = "9"
    Range("E3").Select
    ActiveCell.FormulaR1C1 = "15"
    Range("A4").Select
    ActiveCell.FormulaR1C1 = "Row 3"
    Range("B4").Select
    ActiveCell.FormulaR1C1 = "15"
    Range("C4").Select
    ActiveCell.FormulaR1C1 = "19"
    Range("D4").Select
    ActiveCell.FormulaR1C1 = "20"
    Range("E4").Select
    ActiveCell.FormulaR1C1 = "0"
    Range("A1:E4").Select
    ActiveSheet.Shapes.AddChart2(297, xlColumnStacked).Select
    ActiveChart.SetSourceData Source:=Range("Sheet1!$A$1:$E$4")
    ActiveChart.SetElement (msoElementDataLabelCenter)
    ActiveChart.FullSeriesCollection(1).DataLabels.Select
    ActiveChart.SetElement (msoElementDataLabelNone)
    ActiveSheet.ChartObjects("Chart 1").Activate
    ActiveChart.FullSeriesCollection(1).Select
    Selection.Format.Fill.Visible = msoFalse
    ActiveChart.FullSeriesCollection(2).Select
    With Selection.Format.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(0, 176, 240)
        .Transparency = 0
        .Solid
    End With
    ActiveChart.FullSeriesCollection(3).Select
    With Selection.Format.Fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 0, 0)
        .Transparency = 0
        .Solid
    End With
    Range("H5").Select
End Sub
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Jul 2023 02:55:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-translate-excel-macro-code-for-chart-object-to-abap-code/m-p/12804175#M2025144</guid>
      <dc:creator>xiswanto</dc:creator>
      <dc:date>2023-07-26T02:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to translate excel macro code for chart object to AbAp code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-translate-excel-macro-code-for-chart-object-to-abap-code/m-p/12804176#M2025145</link>
      <description>&lt;P&gt;From the VBA code, you can translate into ABAP, you just need to understand a very simple logic to go from VBA to ABAP.&lt;/P&gt;&lt;P&gt;You have several posts which explain the logic or propose examples:&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2012/03/29/using-ole2-objects-for-create-an-excel-file/"&gt;Using ole2 objects to create an excel file | SAP Blogs&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/5451194/ole-uploading-excel-file-containing-ole-objects-in.html"&gt;OLE Uploading Excel file containing ole objects in worksheet | SAP Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/7070971/merge-table-cells-in-ms-word-ole-objects.html"&gt;Merge table cells in MS Word - OLE objects | SAP Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/12639163/ms-outlook-ole2.html"&gt;MS Outlook &amp;amp; OLE2 | SAP Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/questions/287201/como-eliminar-filas-vacias-en-ole-abap.html"&gt;How to eliminate empty rows in ole abap? | SAP Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2012/05/15/copying-data-from-microsoft-excel-to-abap-using-ole/"&gt;Copying data from Microsoft Excel to ABAP using OLE | SAP Blogs&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 12:56:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-translate-excel-macro-code-for-chart-object-to-abap-code/m-p/12804176#M2025145</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-07-26T12:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to translate excel macro code for chart object to AbAp code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-translate-excel-macro-code-for-chart-object-to-abap-code/m-p/12804177#M2025146</link>
      <description>&lt;P&gt;That's right, you have posted VBA code. The language of "Excel macro" is VBA (Visual Basic for Applications).&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 12:57:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-translate-excel-macro-code-for-chart-object-to-abap-code/m-p/12804177#M2025146</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2023-07-26T12:57:07Z</dc:date>
    </item>
  </channel>
</rss>

