0 Replies Latest reply: May 28, 2012 8:30 AM by Abdur Razak Amod RSS

    Export Pivot Table to Excel

      Hi,

       

      I have the ffg macro that exports two pivot tables and works :

       

      sub sendExcel

                set XLApp = CreateObject("Excel.Application")

                XLApp.Visible = FALSE

                set XLDoc = XLApp.Workbooks.Add

                XLDoc.Sheets(1).name = "By FundCode"

                set XLSheet = XLDoc.Worksheets(1)

                set MyTable = ActiveDocument.GetSheetObject("CH05")

                set XLSheet = XLDoc.Worksheets(1)

                MyTable.CopyTableToClipboard true

                XLSheet.Paste XLSheet.Range("A1")

       

                set MyTable = ActiveDocument.GetSheetObject("CH04")

                MyTable.CopyTableToClipboard true

                XLSheet.Paste XLSheet.Range("H1")

       

       

                XLDoc.SaveAs "Decalog.xls"

       

       

       

       

                XLApp.Visible = False

                XLApp.Quit

                Set XLApp = Nothing

                Set Table = Nothing

       

      end sub

       


      I am also trying to export 2 more pivot tables into the same excel workbook but into different sheets, I have tried for hours to crack this but can't seem to get it right....

       

      Any help will be appreciated...

       

      Regards

      Razak