Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: Printer paper size

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Stockton, California
    Posts
    281
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Is there a way to change the paper size that a printer will use from vb? I tried recording a macro, but it only caught the bit when i changed printers. I tried to specify a default paper size in windows, and it SAYS its correct, but when excel opens the file, it changes back to letter! Help please!

  2. #2
    MrExcel MVP Anne Troy's Avatar
    Join Date
    Feb 2002
    Location
    Westwood NJ
    Posts
    2,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Most print sizes are controlled by the software file settings, and not Windows, with the exception of Visio, I believe. Change the settings in the file, not the printer.
    ~Anne Troy

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Stockton, California
    Posts
    281
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Ok, i did that, BUT i have computers with multiple operating systems running. when i save the settings on a win2k computer, it will work for win2k and 98 computers, but not xp computers, visa versa for xp computers. So is there a way to change the settings in the file with VBA??

    Thanks

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Location
    Ahmedabad Gujarat
    Posts
    303
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    If you want to set a paper size in excel

    sub papersize()
    Worksheets("Sheet1").PageSetup.PaperSize = xlPaperLegal

    end sub


    take online help for setting paper size to be used in vbe for excel.

    ni****h desai

  5. #5
    Board Regular
    Join Date
    Feb 2002
    Location
    Stockton, California
    Posts
    281
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    nisht,

    This looks like the solution I have been hunting for. But one problem, the paper size I'm trying to change to is a custom form called "Epson Dot Matrix".

    I tried
    Worksheets("Sheet1").PageSetup.PaperSize = xlPaperUser("Epson Dot Matrix")
    and a few other combinations but these dont work. How would i do this?

    Thanks!

    [ This Message was edited by: robfo0 on 2002-03-19 19:00 ]

  6. #6
    Board Regular
    Join Date
    Feb 2002
    Location
    Ahmedabad Gujarat
    Posts
    303
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    first define a custom paper size in your epson..printer and then use xlpaperuser..

    Actually i have not tried the code but this will solve your problem... you dont need to write anything in brackets.

    I exactly mean is that you have to define your custom paper size first.

    I your problem is solve please mail me.. so i dont have to try the code.
    ni****h desai

  7. #7
    Board Regular
    Join Date
    Feb 2002
    Location
    Stockton, California
    Posts
    281
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks so much for trying to help me, i still didnt get it to work with this method. I do have the paper type defined and it is called "Epson Dot Matrix" and i tried xlPaperUser and that doesnt work either. I did some extensive searching and found this method:

    it uses the sendkeys to simulate a user doing it! heres the code:

    Sub paperchange()
    xSource = "ep"
    SendKeys "%fu{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}" & xSource & "~~"
    End Sub

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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