Batch horizontal Print Excel

Source: Internet
Author: User

Using the VBA script, use the following: Create a new document, paste the code into the VBA project, and then run it, in the case of an Excel document that needs to be printed in bulk.

The specific code is as follows:

Attribute Vb_name ="Module 1"Subpiliangpring () Attribute PiLiangPring.VB_ProcData.VB_Invoke_Func="\n14"DimCurpath as StringCurpath= Thisworkbook.path &"\"DimXlsfile as StringXlsfile=Dir(Curpath &"*.xls") whileXlsfile <>""    IfXlsfile <> Thisworkbook.name ThenExcel.Application.Workbooks.Open (Curpath&xlsfile)'Activate the latest workbookExcel.Application.Workbooks (Excel.Application.Workbooks.Count). Activate'set the paper type to A4Excel.Application.Workbooks (Excel.Application.Workbooks.Count). ActiveSheet.PageSetup.PaperSize =9       'Print orientation set to landscapeExcel.Application.Workbooks (Excel.Application.Workbooks.Count). ActiveSheet.PageSetup.Orientation =2       'Print only the active worksheetExcel.Application.Workbooks (Excel.Application.Workbooks.Count). Activesheet.printout Excel.Application.Workbooks (xlsfile). Close (False)    End IfXlsfile=DirWendMsgBox("Print Done")End Sub

Batch horizontal Print Excel

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.