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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set paper orientation by programming? 1

Status
Not open for further replies.

MCH

Programmer
Dec 11, 2000
7
0
0
HK

I want change the paper orientation while printing but no affect on the default printer setting. How to code the program to perform it?

Thanks!
mch
 
printer.Orientation = vbprorLandscape
printer.Orientation = vbprorPortriat

I think that most printers will revert to their default setting when your job is finished (printer.EndDoc). If you don't trust this mechanisim, you will need to save the orientation before you set it, and then set it back when you are done.




MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
I keep getting the error Object variable or with block variable not set. How do I set it. I tried the following:

Dim prter As Printer

prter.Orientation = vbPRORLandscape
prter.Orientation = vbPRORPortrait

Didn't work though. Help please.

Delton Phillips.
deltonphillips@hotmail.com

 
In VB, ther is no need to dim the printer to set its
's properties. If you are looking at some of the Ms. Sample code, this is just to select the printer (actually the driver). Once the printer is set, you address it as just "Printer", using the dot operator and the various properties.

Look at my first post. COPY the line(s) EXACTLY. They just LOOK LIKE generic examples, they work for ANY printer, affecting the current/default printer for the duration of the job.

You can even 'execute' the various printer commands from the debug window, such as:

Code:
Printer.orientation = vbprorlandscape
printer.currentx = 1.25
printer.print "Hello World"
Printer.EndDoc

should yield an actual printed piece of paper



MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
Thanks. Worked perfectly.

Delton Phillips.
deltonphillips@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top