For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > August 2005 > Printer Object Question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Printer Object Question
William

2005-08-25, 6:55 pm

Hi,

In my application I want to change the pagesize of the default printer to
11x17 before I print something and then change back the the default Letter.
I know how to get the defautl printer but when I try to change the
printer.pagesize = 17 it gives me an error saying property is read-only. Is
there a way to do this?

Thanks


Ben Amada

2005-08-26, 3:55 am

William wrote:

> Hi,
>
> In my application I want to change the pagesize of the default printer to
> 11x17 before I print something and then change back the the default
> Letter. I know how to get the defautl printer but when I try to change the
> printer.pagesize = 17 it gives me an error saying property is read-only.
> Is there a way to do this?
>
> Thanks


Where did you get 17 from? If you haven't already, you might want to try
the code in the link below to enumerate all of the printer's paper sizes:

http://groups.google.com/group/micr...f1dee1f41?hl=en

Once you run the code, find 11x17 in the combobox and select (or click) it.
The "PaperSize" you are looking for will popup in a message box. Try using
that value for the PaperSize property of the printer object.

Ben


William

2005-08-26, 6:55 pm

Thanks for the post. I took the code and converted it to put the papersizes
into a collection. How do I change this line to only get the papersizes
without the wierd character?

Mid(nameslist, 64 * (ct - 1) + 1, 64)

Thanks


"Ben Amada" <ben@REpoMOweVErpick.com> wrote in message
news:ulJguVgqFHA.3800@TK2MSFTNGP11.phx.gbl...
> William wrote:
>
>
> Where did you get 17 from? If you haven't already, you might want to try
> the code in the link below to enumerate all of the printer's paper sizes:
>
> http://groups.google.com/group/micr...f1dee1f41?hl=en
>
> Once you run the code, find 11x17 in the combobox and select (or click)
> it. The "PaperSize" you are looking for will popup in a message box. Try
> using that value for the PaperSize property of the printer object.
>
> Ben
>



Jeff Johnson [MVP: VB]

2005-08-26, 6:55 pm


"William" <william@email.com> wrote in message
news:euUXuVlqFHA.3424@TK2MSFTNGP14.phx.gbl...

> Thanks for the post. I took the code and converted it to put the
> papersizes into a collection. How do I change this line to only get the
> papersizes without the wierd character?
>
> Mid(nameslist, 64 * (ct - 1) + 1, 64)


I'm going to guess that the code above pulls a substring from a longer
sting, that the substrings are null-terminated, and that the null character
is the "weird character" you refer to. If so, simply use InStr() to check
for the first occurrence of Chr$(0) and trim the string to be one less than
that position.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com