Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Left and top margins - Excel VBA

Status
Not open for further replies.

TopSat

Programmer
Feb 20, 2005
6
DE
HI there,

now i found a way to get informations about the non printable left and top margin of a printer using GetDeviceCaps (PHYSICALOFFSETX , PHYSICALOFFSETY).

But I can't find any information about the right and bottom margins. I assume they are different from the left and top offset. Does anybody know, where I find information about this topic?

The users settings about the margins are located in the printer driver. How can I read this settings?

Thanks in advance for any hint,

TopSat
 
Hi HughLerwill,

thanks again for your advice. I know this thread, it was from you for me ,-)

Working is:

PHYSICALWIDTH
PHYSICALHEIGHT
PHYSICALOFFSETX
PHYSICALOFFSETY


but I still don't know, how to determine right and bottom offset. PHYSICALWIDTH and PHYSICALHEIGHT is the complete size of the actual paper.

This user can choose different settings for the margins in the printer driver. This values I can't read with GetDeviceCaps.

Thanks,

TopSat
 
TopSat,

Given Top and Left I guess you have the top margin and left margins so Bottom should be equal to topMargin+Printer.ScaleHeight and Right should be equal to Left+Printer.ScaleWidth. Think so anyway..

regards Hugh
 
Hi Hugh,

>>>But you have no Printer object in VBA, eek!

That's the point! So my idea is to read this settings out of the printer driver, but how?

Even if I know PHYSICALWIDTH and PHYSICALHEIGHT from GetDeviceCaps I still have no information about the current settings in the driver. And about right and bottom margin I know nothing through GetDeviceCaps.

Thank you,

TopSat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top