Wizard Object

Microsoft Publisher Visual Basic

Wizard Object

Multiple objects Wizard
WizardProperties

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

Using the Wizard object

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.

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
		

Note  Depending on the language version of 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.

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