title: Refresh Pivot Table with XLWINGS
body: <p>I am trying to refresh a pivot table in excel upon data written by XLWINGS.
  As I don't know how to do it directly from XLWINGS, I tried to use VBA.</p>
  
  <p>Let's split my process in 2 steps:</p>
  
  <p>Step1</p>
  
  <p>I launch the python code from vba (my module name is "PosRep", the python code writtes back a range of data in a specified sheet thanks to xlwings.</p>
  
  <pre><code>Sub launchPython()
  RunPython ("import PosRep; PosRep")
  End Sub
  </code></pre>
  
  <p>Step 2</p>
  
  <p>But as I don't know in advance the size of my newly created Range in Excel, I want to select it, add a new Name (NamedRange) and refresh my pivot (already linked to the NamedRange).</p>
  
  <pre><code>Sub SelectRange()
  Worksheets("GPODump").Range("A1").Select
  '...
  End Sub
  </code></pre>
  
  <p>Both Subs work independently well. But I cannot manage to make them work in a raw. The following code: </p>
  
  <pre><code>Sub Main()
  launchPython
  SelectRange
  End Sub
  </code></pre>
  
  <p>produces a VBA error "Select method of Range class failed" on the statement:</p>
  
  <pre><code>Worksheets("GPODump").Range("A1").Select
  </code></pre>
  
  <p>I presume there is a conflict with the XLWINGS VBA module but I can't figure out what it can be...
  Anyone's help would be more than welcome !
  Thx</p>