1 Reply Latest reply on Sep 3, 2011 10:50 AM by Tony Hedge

    [CS2] [VB] I am unable to copy a selection

    Tony Hedge

      I am writing my first InDesign script and I am having trouble with a seemingly simple task.


      I have selected a PageItem from from one of my open Documents, I am trying to copy it so that I can paste it into another of my open documents.

      When I try to copy the Selection I get the following error message:-


                "Cannot copy/cut due to invalid selection state."


      I can see that the Document from which I am copying has a valid selection: SecondDoc.Selection.Count = 1 and that the correct PageItem has been selected.


      I can see that the InDesign application does not have a valid selection: InDesignApp.Selection.Count=0, so when I execute InDesignApp.Copy method I get the above error message.


      How do I copy the document selection to the application selection?

      The following does not seem to work: InDesignApp.Selection=SecondDoc.Selection.


      Here is the failing code sample


                                              InDesignApp.Selection = SecondDoc.Selection                    ????????????????????????


      Any help with this very simple question would be appreciated !