VBA to select the Width and Height to 1 page , Orientation as Landscape and Paper Size to Legal for multiple xlsx files in a folder

  • [xpost][/xpost]

    Hi Team,


    Need assistance for the below query.


    VBA to select the Width and Height to 1 page, Orientation as Landscape and Paper Size to Legal for multiple xlsx files in a folder

  • Try this. I've left all the options that you can change in the PageSetup for reference. I haven't checked it so let me know if it needs any amendments


  • Hi,


    Thank you for your quick reply. Appreciate your help. Need the VBA to apply the changes to all the xlsx files in a folder. So the macro/VBA should change the sheet width and height to 1 Page. Orientation as "Landscape" and Paper Size to "Legal". Request to extend your support.


    Thank you.

  • Hi,


    Yes, it is giving an error pop up message as "Run-time error '438':
    "Object doesn't support this property or method.


    1) Just to be more specific. All the files in the folder are in XLSX format and the data is only in sheet 1 of the workbook.

  • I've edited the code slightly


  • Hi,


    Please suggest a way to make the VBA run faster. The provided code was working really well, however taking little time for the excution. Your help is appreciated.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!