<?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: interacting with excel pivot using code stage in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/interacting-with-excel-pivot-using-code-stage/m-p/86456#M37306</link>
    <description>In the Blue Prism code stage, your first line will typically be: &lt;CODE&gt;Dim Excel = GetInstance(handle)&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;You'll need to pass in the handle of course. Since you can reference Excel.ActiveSheet, there's no need to pass in the workbook name unless you prefer doing it that way. Your code would end up looking like this:&lt;BR /&gt;
&lt;PRE class="language-csharp"&gt;Dim Excel &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;GetInstance&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;handle&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;
Excel&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;ActiveSheet&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;PivotTables&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"PivotTableCustomerType"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;PivotFields&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"[Customer_CustomerGroup].[Result].[Result]"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;ClearAllFilters
Excel&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;ActiveSheet&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;PivotTables&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"PivotTableCustomerType"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;PivotFields&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"[Customer_CustomerGroup].[Result].[Result]"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;CurrentPage &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"[Customer_CustomerGroup].[Result].&amp;amp;[Customer]"&lt;/SPAN&gt;​&lt;/PRE&gt;
&lt;BR /&gt;It might be best to figure out a more generic way to do what you're doing with the pivot tables (get rid of the references to specific names and whatnot), so that way the code will be reusable in the future.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Nicholas Zejdlik&lt;BR /&gt;RPA Developer&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Wed, 19 Aug 2020 12:51:00 GMT</pubDate>
    <dc:creator>NicholasZejdlik</dc:creator>
    <dc:date>2020-08-19T12:51:00Z</dc:date>
    <item>
      <title>interacting with excel pivot using code stage</title>
      <link>https://community.blueprism.com/t5/Product-Forum/interacting-with-excel-pivot-using-code-stage/m-p/86455#M37305</link>
      <description>hello,&lt;BR /&gt;i am trying to interact with a simple excel pivot table. the table has a drop down list with 2 different options. i have copied the vba code to a code stage in BP using record macro in excel.&lt;BR /&gt;&lt;BR /&gt;i feel like the easiest way would be to make a macro, but i dont have the permission to do that.&lt;BR /&gt;&lt;BR /&gt;i am aware that i need to change the code to work with bp, but i dont know how. i am assuming i need workbook and handle handle input.&lt;BR /&gt;here is the code:&lt;BR /&gt;&lt;BR /&gt;Sub customer_pivot()&lt;BR /&gt;'&lt;BR /&gt;' customer_pivot Macro&lt;BR /&gt;' for BP use only&lt;BR /&gt;'&lt;BR /&gt;&lt;BR /&gt;'&lt;BR /&gt; ActiveSheet.PivotTables("PivotTableCustomerType").PivotFields( _&lt;BR /&gt; "[Customer_CustomerGroup].[Result].[Result]").ClearAllFilters&lt;BR /&gt; ActiveSheet.PivotTables("PivotTableCustomerType").PivotFields( _&lt;BR /&gt; "[Customer_CustomerGroup].[Result].[Result]").CurrentPage = _&lt;BR /&gt; "[Customer_CustomerGroup].[Result].&amp;amp;[Customer]"&lt;BR /&gt;End Sub&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Oskar Jennische&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Aug 2020 08:14:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/interacting-with-excel-pivot-using-code-stage/m-p/86455#M37305</guid>
      <dc:creator>OskarJennische2</dc:creator>
      <dc:date>2020-08-19T08:14:00Z</dc:date>
    </item>
    <item>
      <title>RE: interacting with excel pivot using code stage</title>
      <link>https://community.blueprism.com/t5/Product-Forum/interacting-with-excel-pivot-using-code-stage/m-p/86456#M37306</link>
      <description>In the Blue Prism code stage, your first line will typically be: &lt;CODE&gt;Dim Excel = GetInstance(handle)&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;You'll need to pass in the handle of course. Since you can reference Excel.ActiveSheet, there's no need to pass in the workbook name unless you prefer doing it that way. Your code would end up looking like this:&lt;BR /&gt;
&lt;PRE class="language-csharp"&gt;Dim Excel &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;GetInstance&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;handle&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;
Excel&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;ActiveSheet&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;PivotTables&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"PivotTableCustomerType"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;PivotFields&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"[Customer_CustomerGroup].[Result].[Result]"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;ClearAllFilters
Excel&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;ActiveSheet&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;PivotTables&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"PivotTableCustomerType"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;PivotFields&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;"[Customer_CustomerGroup].[Result].[Result]"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;CurrentPage &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"[Customer_CustomerGroup].[Result].&amp;amp;[Customer]"&lt;/SPAN&gt;​&lt;/PRE&gt;
&lt;BR /&gt;It might be best to figure out a more generic way to do what you're doing with the pivot tables (get rid of the references to specific names and whatnot), so that way the code will be reusable in the future.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Nicholas Zejdlik&lt;BR /&gt;RPA Developer&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Aug 2020 12:51:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/interacting-with-excel-pivot-using-code-stage/m-p/86456#M37306</guid>
      <dc:creator>NicholasZejdlik</dc:creator>
      <dc:date>2020-08-19T12:51:00Z</dc:date>
    </item>
    <item>
      <title>RE: interacting with excel pivot using code stage</title>
      <link>https://community.blueprism.com/t5/Product-Forum/interacting-with-excel-pivot-using-code-stage/m-p/86457#M37307</link>
      <description>thanks for your reply. i tried pasting this in my code object with handle input, but i get the following error:&lt;BR /&gt;&lt;BR /&gt;"Compiler error at line 1: 'GetInstance' is not declared. It may be inaccessible due to its protection level."&lt;BR /&gt;&lt;BR /&gt;i am using ms excel extended for my other actions&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Oskar Jennische&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Aug 2020 13:32:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/interacting-with-excel-pivot-using-code-stage/m-p/86457#M37307</guid>
      <dc:creator>OskarJennische2</dc:creator>
      <dc:date>2020-08-19T13:32:00Z</dc:date>
    </item>
    <item>
      <title>RE: interacting with excel pivot using code stage</title>
      <link>https://community.blueprism.com/t5/Product-Forum/interacting-with-excel-pivot-using-code-stage/m-p/86458#M37308</link>
      <description>GetInstance() is a method that's declared in the MS Excel VBO's global code scope (it's also in the MS Excel VBO - Extended object). The problem with creating another object is that MS Excel VBO uses a dictionary to keep track of which handle refers to which Excel application object.&lt;BR /&gt;&lt;BR /&gt;If you're not using the MS Excel VBO or the MS Excel VBO - Extended object, you'll want to copy the global code from one of them to the object that you're using, and you'll also need to implement Open Instance in order create a handle for an Excel application.&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Nicholas Zejdlik&lt;BR /&gt;RPA Developer&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Aug 2020 13:52:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/interacting-with-excel-pivot-using-code-stage/m-p/86458#M37308</guid>
      <dc:creator>NicholasZejdlik</dc:creator>
      <dc:date>2020-08-19T13:52:00Z</dc:date>
    </item>
  </channel>
</rss>

