This content has been marked as final. Show 6 replies
I had something like this happen to me the other day. Does it make any difference if you do the following?
>Set MyGroup = MyPage.Groups.Add(MyGroupArray)
I tried your suggestion but it threw the same error.
Bummer. What is the selection when this is triggered? What is the class of MySelection.Parent?
Do you mean to group the selection, rather than the page? I don't think you can group a page with anything. Should 'Set MyGroupArray(1) = MySelection.Parent' actually be 'Set MyGroupArray(1) = MySelection'?
My apologies if I'm not understanding you problem correctly.
If the selection is some kind of page item, then make the change suggested above and also the command 'Set MyGroup = MyPage.Groups.Add(MyGroupArray)'
I finally figured it out. It turns out that one of the objects (the object I placed) was not returning a groupable object, it was returning a "PDF" object, which was causing the issue. When you place an object, you have to grab the parent of the place item in order to group it. So the end code would look like this:
Dim MyGroup, MyGroupArray(2)
Set MyInDesign = CreateObject("InDesign.Application.Cs2")
Set MyPage = MyInDesign.ActiveWindow.ActivePage
Set MySelection = MyInDesign.Selection.Item(1)
Set MyBlock = MyPage.Rectangles.Add
Set MySymbol = MyPage.Place("T:\eLearning\numbers\Summary Box Symbols\something.ai")
Set MyGroupArray(0) = MyBlock
Rem There was a typo here in the original (I was grabbing the parent)
Set MyGroupArray(1) = MySelection
Rem Here's where the mistake was that was throwing the error.
Set MyGroupArray(2) = MySymbol.Parent
Set MyGroup = MyDoc.Groups.Add(MyGroupArray)