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

Excel Automation (Print option settings) 1

Status
Not open for further replies.
Feb 14, 2000
425
US
With all the options we have anymore I still find myself relying on the good old school method of FoxPro and Excel Automation. For quick and excellent results it cannot be beat!

I have run into one I am having trouble with as the output from excel needs to print using custom page scaling. So I am asking if there is any way I can programmatically set that to say 80% before I present the output to the user? The user pushes a button and the data is collected and pushed to excel. Once formatted I just loExcel.visible=.t. and the user does whatever they need to do with the file. Some need to print the output, some email, and some just save it. It is a long report and if they do not remember to set the print option to scale "all columns on the page" they just end up with unusable scrap paper. I would like to set that option for them before they are presented with the output file. The customer wanted inexpensive so I did not provide a bunch of output options nor will I now. But I hate to see so much paper go to waste and am willing to eat some on this option, so simple, down, and dirty is what I am looking for.

Steve Bowman
Independent Technology, Inc.
CA, USA
 
Something like:

oExcel = Createobject([Excel.Application])
....
oExcel.activesheet.pagesetup.zoom = 80



 
The suggestion by mm0000 did point me in the direction of this

Code:
loXls = Createobject([Excel.Application])

Note other stuff to format the excel sheet here

loXls.Application.PrintCommunication = .f.
loXls.ActiveSheet.PageSetup.FitToPagesWide = 1
loXls.Application.PrintCommunication = .t.
loXls.Visible = .t.


Steve Bowman
Independent Technology, Inc.
CA, USA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top