2 Replies Latest reply: Oct 1, 2010 8:59 AM by Johan Idh RSS

    Bug with a Attach/Detach PivotTables?

      Have a very strange behavior in my Project. I have Sheet1 and sheet2. On Sheet1 exists button with an action Exec Macro DoRep

      On Sheet2 two PivotTables. That's macros:

      sub DoRep

      set doc=ActiveDocument
      set sh1=doc.GetSheetObject("chart1")
      set sh2=doc.GetSheetObject("chart2")
      set fie=doc.fields("field1")

      sh2.Attach
      doc.GetApplication.WaitForIdle
      fie.Select "Cav"
      fie.ToggleSelect "Fish"
      fie.ToggleSelect "Cat"
      fie.ToggleSelect "Dog"
      'doc.recalldocbookmark "Table1"
      doc.GetApplication.WaitForIdle
      sh2.Detach

      sh1.Attach
      doc.GetApplication.WaitForIdle
      fie.Select "Carrot"
      fie.ToggleSelect "Mouse"
      fie.ToggleSelect "Rat"
      'doc.recalldocbookmark "Table2"
      doc.GetApplication.WaitForIdle
      sh1.Detach


      end sub

      Such a problem - if button belongs Sheet1 - macros doesnt makes correctly result, only if button on sheet2 all correct

       

      Can You help me?