Working with group wizard shapes

When I was discussing shape-level wizard properties the other day, I mentioned group wizard shapes, which are related to, but independent from, the publication and page-level wizards. So here’s where I explain what I meant.

Like wizard publications and wizard pages, group wizard shapes are pre-designed, and can morph. In Publisher, morphing refers to an object’s ability (be it a shape, page, or entire publication) to change its appearance based on the user’s choice of design. Choose a different design, and Publisher automatically updates the object according to the design chosen. So group wizard shapes are exactly what their name implies: grouped shapes that can automatically change appearance based on the design chosen for them.

Here’s where they differ from publication or page wizards:

· You can add group wizard shapes to any publication, whether or not it’s based on a publication wizard.

· You set the design of each group wizard shape individually. This means that the appearance of each group wizard shape is independent from any wizard the publication is based on, as well as any other group wizard shapes you might have added to the publication. This applies only to the group wizard shapes you insert into the publication.

Group wizard shapes have a Shape.Type property of pbGroupWizard. You add them to a page’s Shapes collection by using the AddGroupWizard method, which lets you specify the group wizard type (calendar, navigation bar, coupon, etc.) as well as the design to apply to the shape. Other than morphing, group wizard shapes can generally be manipulated like any other grouped shape.

In the UI, group wizard shapes are called Design Gallery Objects, and are available from the Insert menu.

How group wizard shapes interact with publication or page-level wizards

My second bullet point above does have a caveat, as I mentioned, it only applies to the group wizard shapes you insert into the publication. Some publication or page wizards include group wizard shapes as part of certain designs. For instance, some newsletter wizard designs include table of contents shapes, and some web site wizard designs include navigation bars.

In these cases, the group wizard shape does automatically update if you change the wizard design the publication is based on. But, here’s where things get confusing: it matters how the shape is added to the publication. If the group wizard shape is added as a publication or page-level wizard option, then Publisher treats it as belonging to the publication wizard; that is, Publisher updates the shape when the publication wizard is changed. However, if you add the group wizard shape using the Shapes.AddGroupWizard method, Publisher treats it as independent of the publication wizard.

As with any other shape, you can determine whether a group wizard shape is part of a publication or page-level wizard design by getting its WizardTag property; if it’s anything but zero, it’s part of the wizard design.

To illustrate this, consider the following two code samples. They both create a new publication based on a newsletter wizard, and then add a calendar, which is a group wizard shape, to the third page. The first example adds the calendar as a wizard page option. Because of this, Publisher treats the calendar as belonging to the publication wizard; change the wizard design, and the calendar’s appearance updates accordingly.

Sub CreateNewsletterWithDependentGroupWizardShape()

    Dim newDoc As Document

    'create a newsletter publication

    Set newDoc = NewDocument(pbWizardNewsletters, 31)

    With newDoc.Pages

        'sets page 3 as active page

        newDoc.ActiveView.ActivePage = .Item(3)

        'adds a calendar to page 3

        If .Item(3).Wizard.Properties.FindPropertyById(44).Enabled = True Then

            .Item(3).Wizard.Properties.FindPropertyById(44).CurrentValueId = 2

        Else

            Debug.Print "This property is not enabled."

        End If

    End With

   

End Sub

In this case, the calendar is added using the AddGroupWizard method. Publisher treats the calendar as an independent group wizard shape; it does not update if the publication wizard design is changed.

Sub CreateNewsletterWithIndependentGroupWizardShape()

    Dim newDoc As Document

    Set newDoc = NewDocument(pbWizardNewsletters, 31)

    newDoc.Pages(3).Shapes.AddGroupWizard _

        pbWizardGroupCalendars, Left:=72, Top:=72, Design:=16

   

End Sub

In this publication, the accent box shape in the upper left hand corner of the first page is a group wizard inserted by the publication wizard. The calendar you added is not. You can confirm this by running the following code (in the new document’s VBE window) with each shape selected in turn:

Debug.Print ThisDocument.Selection.ShapeRange.WizardTag

The accent box returns a wizard tag value of 2012; the calendar returns 0. the accent box updates when the publication wizard design is changed; the calendar does not. Note that if you change the color scheme, however, all the shapes that are set to color scheme colors update.

For a general overview of publication and page-level wizards, see my article on MSDN:

https://www.msdn.microsoft.com/office/understanding/publisher/articles/default.aspx?pull=/library/en-us/odc_pb2003_ta/html/odc_pb_createwizardpubs.asp