Table of contents
TOC
Collapse the table of content
Expand the table of content

PageSetup.AvailablePageSizes Property (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

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 (in Windows Vista) or My Documents (in Windows XP) 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
© 2018 Microsoft