PDA

View Full Version : How to print 1st page of several excell workbooks



karpatov
09-03-2007, 01:16 PM
Hi.
I would like to print 1st page (not whole worksheet) of all the xls in the directory. I can loop through the files and get filename but I dont know how to do the printing part - setting landscape orientation, choosing printer. Would someone help me? Tx. karpatov

malik641
09-03-2007, 06:29 PM
Hi karpatov, Welcome to VBAX

Record a macro and perform the printing part you're trying to accomplish. Set the landscape, choose the printer, etc. At the end, just do a print preview, then close it and stop macro recording. View the results (you will see many options you can change in the code by doing this). This should help you get started.

Also, take a look at the Worksheet.PrintOut method in the help files. This should be most of what you need (except for the landscape orientation).

Good luck!

mdmackillop
09-04-2007, 12:03 AM
Check out this KB Item (http://www.vbaexpress.com/kb/getarticle.php?kb_id=9)