![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Stockton, California
Posts: 281
|
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 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,512
|
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 |
|
Board Regular
Join Date: Feb 2002
Location: Stockton, California
Posts: 281
|
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 |
|
Board Regular
Join Date: Feb 2002
Location: Ahmedabad Gujarat
Posts: 303
|
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. nishith desai |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Location: Stockton, California
Posts: 281
|
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 |
|
Board Regular
Join Date: Feb 2002
Location: Ahmedabad Gujarat
Posts: 303
|
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. nishith desai |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Feb 2002
Location: Stockton, California
Posts: 281
|
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|