Wizard Object

Publisher Developer Reference

Represents the publication design associated with a publication or the wizard associated with a Design Gallery object.

Example

Use the Wizard property of a Document, Page, Shape or ShapeRange object to return a Wizard object. The following example reports on the publication design associated with the active publication, displaying its name and current settings.

Visual Basic for Applications
  Dim wizTemp As Wizard
Dim wizproTemp As WizardProperty
Dim wizproAll As WizardProperties

Set wizTemp = ActiveDocument.Wizard

With wizTemp Set wizproAll = .Properties MsgBox "Publication Design associated with " _ & "current publication: " _ & .Name For Each wizproTemp In wizproAll With wizproTemp MsgBox " Wizard property: " _ & .Name & " = " & .CurrentValueId End With Next wizproTemp End With

Aa436454.vs_note(en-us,office.12).gif  Note
Depending on the language version of Microsoft Office Publisher that you are using, you may receive an error when using the above code. If this occurs, you will need to build in error handlers to circumvent the errors. The following example functions as the code above but has error handlers built in for this situation.
Visual Basic for Applications
  Sub ExampleWithErrorHandlers()
    Dim wizTemp As Wizard
    Dim wizproTemp As WizardProperty
    Dim wizproAll As WizardProperties
Set wizTemp = ActiveDocument.Wizard

With wizTemp
    Set wizproAll = .Properties
    Debug.Print "Publication Design associated with " _
        & "current publication: " _
        & .Name
    For Each wizproTemp In wizproAll
        With wizproTemp
            If wizproTemp.Name = "Layout" Or wizproTemp _
                    .Name = "Layout (Intl)" Then
                On Error GoTo Handler
                MsgBox "   Wizard property: " _
                    & .Name & " = " & .CurrentValueId

Handler: If Err.Number = 70 Then Resume Next Else MsgBox " Wizard property: " _ & .Name & " = " & .CurrentValueId End If End With Next wizproTemp End With End Sub

See Also