Skip to main content
Participant
April 26, 2008
Question

Create Group CS3 - VB

  • April 26, 2008
  • 2 replies
  • 265 views
I am trying to create a group of all items on a page to be able to resize everything to fit within a page.
The code to create the group is

Set mytempGroup = myInDesign.ActiveDocument.Groups.Add(myInDesign.ActiveWindow.Activepage.PageItems)

and it works on page 1. When I move to page 2 and rerun the script, it does not work. I get a message --

Error Number: 30477
Error String: Invalid Parameter.

Does anybody know what the problem is?
This topic has been closed for replies.

2 replies

Participant
April 26, 2008
That did it.

Thank you very much.

Patrick
Inspiring
April 26, 2008
The problem is the reference to the groups collection. That collection you're referring to is all the groups in the document. InDesign apparently relates that collection to page 1 and so it works on page 1. Try:

Set myPage = myInDesign.ActiveWindow.ActivePage
Set mytempGroup = myPage.Groups.Add(myPage.PageItems)

Dave