Export (0) Print
Expand All

PageSetup.AvailablePageSizes Property

Office 2007
Returns the PageSizes collection that contains all the PageSize objects available in the current publication.

Version Information
 Version Added:  Publisher 2007

Syntax

expression.AvailablePageSizes

expression   A variable that represents a PageSetup object.

Return Value
PageSizes

Remarks

PageSize objects correspond to the icons displayed under Blank Page Sizes in the Page Setup dialog box in the Microsoft Office Publisher user interface.

Page sizes returned by the AvailablePageSizes property include not only the page sizes provided by Microsoft Office Publisher, but also custom page sizes that you create or download, if any.

As you add or remove custom page sizes, the index number for all existing page sizes may change.

Example

The following Microsoft Visual Basic for Applications (VBA) macro shows how to create a text file that contains the list of all page sizes available in the current publication and their corresponding index numbers. It saves the text file to the Documents (in Windows Vista) or My Documents (in Windows XP) folder of the current user.

Visual Basic for Applications
Public Sub AvailablePageSizes_Example()

    Dim pubPageSize As Publisher.PageSize
    Dim pubPageSizes As Publisher.PageSizes    
    Dim intCount As Integer    
    Dim lngPageSizeFile As Long

    intCount = 1
    
    Set pubPageSizes = ThisDocument.PageSetup.AvailablePageSizes   

    lngPageSizeFile = FreeFile
	   Open Environ("USERPROFILE") + "\My Documents\PageSizeList.txt" For Output Access Write As lngPageSizeFile

    For Each pubPageSize In pubPageSizes
        Write #lngPageSizeFile, pubPageSize.Name, intCount
        intCount = intCount + 1
    Next
    
    Close lngPageSizeFile
    
End Sub



Community Additions

ADD
Show:
© 2015 Microsoft