Consulting

Results 1 to 9 of 9

Thread: Solved: Return Available Paper Names and Sizes

  1. #1
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location

    Solved: Return Available Paper Names and Sizes

    The following code will return the number constants of paper sizes available. I want to determine the names, xlA4, xlLegal etc. Any ideas?
    [VBA]
    Sub PaperSizes()
    Do
    i = i + 1
    On Error Resume Next
    ActiveSheet.PageSetUp.PaperSize = i
    Debug.Print ActiveSheet.PageSetUp.PaperSize
    Loop
    End Sub
    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Open the Object Browser and search for xlPaperSize.

    You will get a list of all the constants, click on one to get the value.

  3. #3
    Moderator VBAX Guru Ken Puls's Avatar
    Joined
    Aug 2004
    Location
    Nanaimo, BC, Canada
    Posts
    4,001
    Location
    Hey Jake,

    Malcolm actually wants to populate a combobox with the PaperSize names, I believe. The object broswer isn't really going to work for him for this.
    Ken Puls, CMA - Microsoft MVP (Excel)
    I hate it when my computer does what I tell it to, and not what I want it to.

    Learn how to use our KB tags! -||- Ken's Excel Website -||- Ken's Excel Forums -||- My Blog -||- Excel Training Calendar

    This is a shameless plug for my new book "RibbonX - Customizing the Office 2007 Ribbon". Find out more about it here!

    Help keep VBAX clean! Use the 'Thread Tools' menu to mark your own threads solved!





  4. #4
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    I think you would have to make the list yourself.

    PaperB4
    PaperB5
    PaperCSheet
    PaperDSheet
    PaperEnvelope10
    PaperEnvelope11
    PaperEnvelope12
    PaperEnvelope14
    PaperEnvelope9
    PaperEnvelopeB4
    PaperEnvelopeB5
    PaperEnvelopeB6
    PaperEnvelopeC3
    PaperEnvelopeC4
    PaperEnvelopeC5
    PaperEnvelopeC6
    PaperEnvelopeC65
    PaperEnvelopeDL
    PaperEnvelopeItaly
    PaperEnvelopeMonarch
    PaperEnvelopePersonal
    PaperESheet
    PaperExecutive
    PaperFanfoldLegalGerman
    PaperFanfoldStdGerman
    PaperFanfoldUS
    PaperFolio
    PaperLedger
    PaperLegal
    PaperLetter
    PaperLetterSmall
    PaperNote
    PaperQuarto
    PaperStatement
    PaperTabloid

  5. #5
    VBAX Mentor Sir Babydum GBE's Avatar
    Joined
    Mar 2005
    Location
    Cardiff, UK
    Posts
    499
    Location
    Missed PaperA4 - the principal British paper size!
    Have a profound problem? Need a ridiculous solution? Post a question in Babydum's forum

  6. #6
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    You guys always have to be different. Shouldn't it be PaperAU4 tho?

  7. #7
    Administrator
    VP-Knowledge Base VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Quote Originally Posted by Babydum
    Missed PaperA4 - the principal British paper size!
    Ahumss the principal European size that is!
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  8. #8
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Thanks to all.
    Paper sizes and names resolved here Controlling the Printer from Word VBA
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  9. #9
    Moderator VBAX Mentor sheeeng's Avatar
    Joined
    May 2005
    Location
    Kuala Lumpur
    Posts
    392
    Location
    Quote Originally Posted by DRJ
    Open the Object Browser and search for xlPaperSize.

    You will get a list of all the constants, click on one to get the value.
    Wow, I never know paper size can be listed in VBA..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •