1 Reply Latest reply: Apr 10, 2015 5:26 AM by Massimiliano Rosso RSS

    Export multiple Container into Excel

    Christian Wylezol

      Hi,

       

      could somebody of you please help me?

      I have a container with different diagrams. Now I want to export them into Excel.

      Each Diagram should be exported (via XL-Button) to Excel but all in the same File just in different Sheets.

       

       

      Solution In Excel:

      How can I realize that?

       

      Thanks in advance.

       

      Chris

        • Re: Export multiple Container into Excel
          Massimiliano Rosso

          Hi Christian,

          you have to use macro to do this. XL button is limited.

          At the moment I don't know how to cycle through container's objects but you could try this:

           

          sub export()

              set XLApp = CreateObject("Excel.Application")

              set XLDoc = XLApp.Workbooks.Add 

              do while XLApp.ActiveWorkbook.Worksheets.Count < 5 'if you want to export 5 charts

                 XLApp.ActiveWorkbook.Worksheets.Add

              loop

           

              for i = 1 to 5

                  set obj = ActiveDocument.GetSheetObject("CH"& right("0"&i,2)) 'your carts'id have to be from 1 to 5

                  Set rngStart = XLDoc.Sheets(i).Range("A1")

                  obj.CopyTableToClipboard true

                  XLDoc.Sheets(i).Paste()

                     XLApp.Sheets(i).Name = obj.GetCaption.Name.v

              next   

          end sub

           

          Hope it helps.

          Regards,

           

          MR