2 Replies Latest reply on Dec 10, 2009 6:31 AM by mlamers

    paste Excel chart into InDesign

    mlamers

      Hi,

       

      I'm attempting to paste an Excel chart into an Indesign CS2 document.

      In the document I created a placeholder with the Rectagle Frame Tool and named it in the Script Label palette.

      Here is the code so far:

       

      tell application "Microsoft Excel"
          activate
          set sourceBook to workbook "test.xlsx"
          activate sheet "Charts" of sourceBook
          set pt to chart object 1 of sheet "Charts"
         
          copy object (chart object 1 of sheet "Charts")
         
          tell application "Adobe InDesign CS2"
              activate
              tell document 1
                  paste into page item "test" of layer "Artwork" of page 12
              end tell
          end tell
      end tell

       

      I get the error message that the command "paste into" is not understood. However if I use the Paste Into command from the Edit menu, the chart is pasted.

      Any hints?

       

      regards,

      Marcel

        • 1. Re: paste Excel chart into InDesign
          mlamers Level 1

          Here is what did the trick:

           

              tell application "Adobe InDesign CS2"
                  activate
                  tell rectangle "test" of page 12 of document 1
                      select
                  end tell
                  paste into
              end tell

           

          regards,

          Marcel

          • 2. Re: paste Excel chart into InDesign
            AdobeScripts Level 3

            I get the error message that the command "paste into" is not understood. However if I use the Paste Into command from the Edit menu, the chart is pasted.

            Because Page isn't the object you can paste "into" - you can paste "on page".

             

            From VB6 ObjectBrowser - PasteInto definition:

             

            Sub PasteInto()
                Member of InDesign.Application
                Pastes data from the clipboard into the selected object in the active document window.

             

            So first you need to create rectangle on specified layer&page and then paste in to this rectangle - UI sometimes do more than you think .

             

            robin

            www.adobescripts.co.uk