dbTalk Databases Forums  

Setting Application.Printer.PaperSize

comp.databases.ms-access comp.databases.ms-access


Discuss Setting Application.Printer.PaperSize in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #11  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: Setting Application.Printer.PaperSize - 10-11-2010 , 11:50 AM






Salad <salad (AT) oilandvinegar (DOT) com> wrote in
news:Q8adnePRUK31VzLRnZ2dnUVZ_h-dnZ2d (AT) earthlink (DOT) com:

Quote:
http://bytes.com/topic/access/answer...rinter-setting
s http://support.microsoft.com/default...b;en-us;210283
http://bytes.com/topic/access/answer...user-defined-p
aper-sizes
The second of those links is for the old-fashioned PrtDevMode method
of controlling the printer, which is vastly more complicated and
fussy than using the new Printer object.

I also see from the first link there that each form has it's own
Printer object, and when I use the object browser, I find that every
form and report has it's own printer object. My guess is that you
need to set that instead of the Application.Printer object (though
I'd expect the form/report Printer object to inherit settings from
the Application.Printer object, though saved settings would no doubt
override the inherited properties).

So far as I can tell, these properties can be set in an MDE/ACCDE,
but obviously cannot be saved.

Where this is done, I'm not sure -- in the report's OnOpen event? Or
in code after opening the report?

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #12  
Old   
Bob Darlington
 
Posts: n/a

Default Re: Setting Application.Printer.PaperSize - 10-11-2010 , 06:09 PM






Thanks David.
I've taken out the decimal points and changed the code to work on the
report's printer object to no avail.
It still wants to revert to 'Letter' paper size, but I can't see where it
takes that value from.

--
Bob Darlington
Brisbane
"David-W-Fenton" <NoEmail (AT) SeeSignature (DOT) invalid> wrote

Quote:
Salad <salad (AT) oilandvinegar (DOT) com> wrote in
news:Q8adnePRUK31VzLRnZ2dnUVZ_h-dnZ2d (AT) earthlink (DOT) com:

http://bytes.com/topic/access/answer...rinter-setting
s http://support.microsoft.com/default...b;en-us;210283
http://bytes.com/topic/access/answer...user-defined-p
aper-sizes

The second of those links is for the old-fashioned PrtDevMode method
of controlling the printer, which is vastly more complicated and
fussy than using the new Printer object.

I also see from the first link there that each form has it's own
Printer object, and when I use the object browser, I find that every
form and report has it's own printer object. My guess is that you
need to set that instead of the Application.Printer object (though
I'd expect the form/report Printer object to inherit settings from
the Application.Printer object, though saved settings would no doubt
override the inherited properties).

So far as I can tell, these properties can be set in an MDE/ACCDE,
but obviously cannot be saved.

Where this is done, I'm not sure -- in the report's OnOpen event? Or
in code after opening the report?

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #13  
Old   
Bob Darlington
 
Posts: n/a

Default Re: Setting Application.Printer.PaperSize - 10-11-2010 , 06:25 PM



Further to my earlier reply, the 'Letter' setting was coming from the report
Page Setup, which I must have inadvertently reset during testing.
So the code I've posted, uses whatever page size is set in the report
design, and won't accept the new values set in the posted code.
If I manually select a custom paper size 'Cheque' (which has the same
dimensions) all works OK.

--
Bob Darlington
Brisbane
"David-W-Fenton" <NoEmail (AT) SeeSignature (DOT) invalid> wrote

Quote:
Salad <salad (AT) oilandvinegar (DOT) com> wrote in
news:Q8adnePRUK31VzLRnZ2dnUVZ_h-dnZ2d (AT) earthlink (DOT) com:

http://bytes.com/topic/access/answer...rinter-setting
s http://support.microsoft.com/default...b;en-us;210283
http://bytes.com/topic/access/answer...user-defined-p
aper-sizes

The second of those links is for the old-fashioned PrtDevMode method
of controlling the printer, which is vastly more complicated and
fussy than using the new Printer object.

I also see from the first link there that each form has it's own
Printer object, and when I use the object browser, I find that every
form and report has it's own printer object. My guess is that you
need to set that instead of the Application.Printer object (though
I'd expect the form/report Printer object to inherit settings from
the Application.Printer object, though saved settings would no doubt
override the inherited properties).

So far as I can tell, these properties can be set in an MDE/ACCDE,
but obviously cannot be saved.

Where this is done, I'm not sure -- in the report's OnOpen event? Or
in code after opening the report?

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #14  
Old   
Bob Darlington
 
Posts: n/a

Default Re: Setting Application.Printer.PaperSize - 10-11-2010 , 08:20 PM



"Salad" <salad (AT) oilandvinegar (DOT) com> wrote

Quote:
Bob Darlington wrote:

I changed the code to:
Application.Printer = Application.Printers("Cheque Printer")
Application.Printer.PaperSize = acPRPSUser
Application.Printer.ItemSizeHeight = 5301
Application.Printer.ItemSizeWidth = 15252
Application.Printer.PaperBin = acPRBNTractor
Application.Printer.BottomMargin = 1
Application.Printer.TopMargin = 1
Application.Printer.LeftMargin = 1
Application.Printer.RightMargin = 1
Application.Printer.Orientation = acPRORPortrait

MsgBox Application.Printer.ItemSizeWidth & vbNewLine & _
Application.Printer.ItemSizeHeight & vbNewLine & _
Application.Printer.PaperBin & vbNewLine & _
Application.Printer.BottomMargin & vbNewLine & _
Application.Printer.TopMargin & vbNewLine & _
Application.Printer.LeftMargin & vbNewLine & _
Application.Printer.RightMargin & vbNewLine & _
Application.Printer.Orientation & vbNewLine & _
Application.Printer.PaperSize

With the following result:
15252
5301
8
1
1
1
1
1
256

So it is accepting the new values, but not using them when I subsequently
open the report (in Preview or normal).
Whilst I want to be able to use this in a distributed mde, this testing is
still being done in the mdb, so the mde is not the problem (yet).
For testing purposes, the 'Cheque' report I am trying to print, is set in
design mode to use the specific printer 'Cheque Printer' and paper size
'A4'.
If I set the paper size to the custom for the report, it works OK in the
mdb, but when I load the mde to the client PC, it resets to A4 -hence the
need for this code. My current work around is to load the mdb to the
client, open it in TS and reset the paper size, then make the mde on the
client PC. I was hoping to overcome this cumbersome approach.


Hi Bob:

Hmmm...I was thinking that you said it worked if you set it manually. So I
think you would like to know the values when it works. Not the above
setting the values and then doing a display. I'm not sure where you got
the initial values to set them to.

Here's a link to MS's site. It's less than you have. Slightly different.
Not as many value changes. http://support.microsoft.com/kb/284286
Further to the above, if I change
..ItemSizeWidth = 15252
to read
..ItemSizeWidth = 5252
there is no change in the resultant layout. It still goes back to letter.
If I use .PaperSize = acPRPSEnvDL instead of acPRPSUser, it will format to
DL size.
So it appears to be ignoring the ItemSizeWidth whenever acPRPSUser is
selected.
It reads acPRPSUser as 'Letter' and ignores the rest.

Reply With Quote
  #15  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: Setting Application.Printer.PaperSize - 10-12-2010 , 02:29 PM



"Bob Darlington" <bob (AT) notheredpcman (DOT) com.au> wrote in
news:4cb39932$0$32441$afc38c87 (AT) news (DOT) optusnet.com.au:

Quote:
I've taken out the decimal points and changed the code to work on
the report's printer object to no avail.
It still wants to revert to 'Letter' paper size, but I can't see
where it takes that value from.
You know, I recently had a case where I couldn't get Word to print
on index cards to a printer that it had been working with for years
when it was using a parallel cable instead of USB. I ended up
changing a bunch of settings for the printer setup that finally
allowed me to change the paper size in Word and print successfully.

My point is simply that perhaps there's something wrong with the
configuration of this particular printer that's preventing your
coded changes from taking.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #16  
Old   
Bob Darlington
 
Posts: n/a

Default Re: Setting Application.Printer.PaperSize - 10-12-2010 , 05:31 PM



Thanks David.
I tried different ports (LPT1, USB etc and even Print to File) without luck.
Still opens in 'Letter' size.

--
Bob Darlington
Brisbane
"David-W-Fenton" <NoEmail (AT) SeeSignature (DOT) invalid> wrote

Quote:
"Bob Darlington" <bob (AT) notheredpcman (DOT) com.au> wrote in
news:4cb39932$0$32441$afc38c87 (AT) news (DOT) optusnet.com.au:

I've taken out the decimal points and changed the code to work on
the report's printer object to no avail.
It still wants to revert to 'Letter' paper size, but I can't see
where it takes that value from.

You know, I recently had a case where I couldn't get Word to print
on index cards to a printer that it had been working with for years
when it was using a parallel cable instead of USB. I ended up
changing a bunch of settings for the printer setup that finally
allowed me to change the paper size in Word and print successfully.

My point is simply that perhaps there's something wrong with the
configuration of this particular printer that's preventing your
coded changes from taking.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #17  
Old   
Salad
 
Posts: n/a

Default Re: Setting Application.Printer.PaperSize - 10-12-2010 , 07:30 PM



Bob Darlington wrote:

Quote:
Thanks David.
I tried different ports (LPT1, USB etc and even Print to File) without luck.
Still opens in 'Letter' size.

How old is your printer? Troubleshooting this on the newsgroup is free
except for your time. After a while the cost of a new printer that
works would be more cost effective than working with a printer that is
obstinate.

Maybe contact your printer mfg.

Maybe see if there are newer drivers.

Reply With Quote
  #18  
Old   
Bob Darlington
 
Posts: n/a

Default Re: Setting Application.Printer.PaperSize - 10-13-2010 , 04:59 PM



"Salad" <salad (AT) oilandvinegar (DOT) com> wrote

Quote:
Bob Darlington wrote:

Thanks David.
I tried different ports (LPT1, USB etc and even Print to File) without
luck.
Still opens in 'Letter' size.

How old is your printer? Troubleshooting this on the newsgroup is free
except for your time. After a while the cost of a new printer that works
would be more cost effective than working with a printer that is
obstinate.

Maybe contact your printer mfg.

Maybe see if there are newer drivers.

Good thinking. So I tried the same code with my Laser Printer and got the
same result.
The problem 'appears' to be with acPRPSUser.
ie the the following lines don't get recognised:
.DefaultSize = False
.PaperSize = acPRPSUser
.ItemSizeHeight = 5301
.ItemSizeWidth = 15252
If I use .PaperSize = acPRPSEnvDL for example, it reads that format OK but
if I use acPRPSUser with the above dimensions, it goes back to Letter each
time.

And all this is still in the mdb on my development PC - before it gets
deployed to the client.
Has anyone else used a custom printer setup successfully?

Bob Darlington
Brisbane

Reply With Quote
  #19  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: Setting Application.Printer.PaperSize - 10-14-2010 , 02:50 PM



"Bob Darlington" <bob (AT) notheredpcman (DOT) com.au> wrote in
news:4cb4e1a7$0$3032$afc38c87 (AT) news (DOT) optusnet.com.au:

Quote:
I tried different ports (LPT1, USB etc and even Print to File)
without luck. Still opens in 'Letter' size.
If I recall correctly, in my case, it also had something to do with
the Windows Print Spooler. With a networked printer, as opposed to
directly connected (as was the case when I encountered the problem),
I don't know if that's possible or not.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #20  
Old   
Bob Darlington
 
Posts: n/a

Default Re: Setting Application.Printer.PaperSize - 10-18-2010 , 01:54 AM



"David-W-Fenton" <NoEmail (AT) SeeSignature (DOT) invalid> wrote

Quote:
"Bob Darlington" <bob (AT) notheredpcman (DOT) com.au> wrote in
news:4cb4e1a7$0$3032$afc38c87 (AT) news (DOT) optusnet.com.au:

I tried different ports (LPT1, USB etc and even Print to File)
without luck. Still opens in 'Letter' size.

If I recall correctly, in my case, it also had something to do with
the Windows Print Spooler. With a networked printer, as opposed to
directly connected (as was the case when I encountered the problem),
I don't know if that's possible or not.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/
Thanks David,
I've just tried all possible settings in that area with no luck.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.