PageSetup.AvailablePageSizes property (Publisher)

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

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 Publisher user interface.

Page sizes returned by the AvailablePageSizes property include not only the page sizes provided by Microsoft 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 or My Documents folder of the current user.

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.