How to get Bot to open Payslips file by file, "Set Print Area" then Print


I am new to the wonders and world of Macro, VBA and RPA, and would like to study it more. Recently did a short course on RPA.

Just want to share my problem and throw a question out to the Community here.

My Pain Point:
I’m the person printing the Payslips for the Company.

Currently I am opening all 30+ Single Excel File Payslips generated by Excel VBA (not done by me) for my company one by one and setting to print by Set Print Area for EACH Payslip Standalone Excel File, and printing them one by one. This takes up quite some time which I believe can be saved with either the right Print Settings, VBA or RPA.

Unfortunately I am still exploring these.

But I would like to ask for RPA, if I’d like to automate that process (of opening the 1st payslip, setting the print area, printi → opening the 2nd payslip, setting the print area, print so on and so forth till the last Payslip), what Activities do I have to do / explore to have the Bot do this?

1 Like

Hi @irist

Maybe the following component can help you to set print area in Excel.

1 Like


Try below steps.

  1. First read all excel files from folder by using below expression.

    arrExcelFiles [] = Directory.GetFiles("FolderPath","*.xlsx")
  2. Then use ForEach loop activity to iterate one by one file.

     ForEach item in arrExcelFiles
         - use Start Process activity and pass item to it.
         - And then use Send Hotkey Activity and send Ctrl+p
         - use click activity to click on Print to give printout.

This process will continue till all files completed in the folder.


Um do I download this? How do I do so (sorry major noob here). Doesnt seem to have an option…

Hi… where do I type the first expression… lol :sweat_smile::sweat_smile::sweat_smile:


Use Assign Activity.

Create one array of string variable and say arrExcelFiles and write this on left hand side and right hand side part will be after equal sign.

So you said “ForEach item in arrExcelFiles
- use Start Process activity and pass item to it.”

How do you “Pass item to it”?
after I select “Start Process” activity, what should I type in the first line?

In start process activity mention as item.ToString in the property FileName
This will open the file in foreground one by one
Cheers @akhilbansal01

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.