Article View: adobe.scripting.indesign
Article #20510Problem Grouping an Arbitrary Number of PageItems
From: Alex S McLellan
Date: Fri, 05 Jul 2002 20:53
Date: Fri, 05 Jul 2002 20:53
16 lines
1981 bytes
1981 bytes
I needed to create a reusable function that accepts a collection of PageItems and returns a Group object that contains the PageItems. I did this in version 1.5.2 using a 'ReDim' statement in the function to size the variant array according to the number of PageItems in the collection. In version 1.5.2, the following statement worked: ReDim MyVarArray (myCollection.Count) as Variant This didn't work in version 2.0.1 unless both bounds were specified, i.e., ReDim MyVarArray (1 to MyCollection.Count) as Variant but it only works the first time the function is called. On subsequent calls, the group.add method fails with 'runtime error 30470: Invalid Parameter'. I tried Dim VarArray(100) so that the array is always large enough to group my PageItems but this fails with the same message (and it probably does so because the array isn't full). All of the code examples I've seen use a fixed number of PageItems. Is there a better way to do this so that I can group an arbitrary number of PageItems? The only alternative that I've found so far is to use the Document.Select method to identify each PageItem and then pass Document.Selection to the Group.Add method but this is awkward and probably carries a performance penalty.
Technical Details
Message-ID:
<ef9808c.-1@WebX.aaQKaf7vad4>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-08!supernews.com!newsfeed.news2me.com!opentransit.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebXShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,dc30567768e81fbb,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-07-05 14:09:42 PST From: "Alex S McLellan" <alex.mclellan@moh.gov.on.ca> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-08!supernews.com!newsfeed.news2me.com!opentransit.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Problem Grouping an Arbitrary Number of PageItems Message-ID: <ef9808c.-1@WebX.aaQKaf7vad4> Date: Fri, 5 Jul 2002 13:53:15 -0700 Lines: 28 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit