How to take screenshot for multiple excel sheets which are present in same excel file

Suppose, we have a excel file, where we have 20 different sheets. I need to use loop to get the screenshot for all 20 sheets and take the screenshot of some particular area and wanna save it. Kindly help.

  • Open the workbook using excel application scope - pass out Workbook variable

  • Assign Sheets (IEnumberable(Of String) = workbook.getsheets

  • For Each item in Sheets (TypeArgument = String)

  • Take Screenshot of sheet and save image

  • Send Hotkey = Crtl + pgdn (SpecialKey)

Thanks for the response Tim. I tried almost same but not getting result. Could you please attach a sample workflow. Help will be appreciated. Thanks in Advance.

Please attach your workflow and I can advise where the errors are.

Main (9).xaml (8.7 KB)

You need to move the for each outside of the excel application scope and also have an output for the screenshot

If I will take it outside the scope. How it will iterate the excel sheet? Could you please attach the workflow!!

@khan
I have created a sample workflow which will take screenshots of multiple sheets which are present in same excel.
I hope it will help you
Main.xaml (9.4 KB)

Main (9).xaml (9.4 KB)

This will allow the sheets to be named anything.

As you are passing an output variable for workbook it will remain open.
Then you can get the sheets of the workbook by assigning it and loop through that.

It is taking the same screenshot with different name only.

Hi munna… just tell me how you are using while condition … its not working properly

Hi,

I forgot to add Send Hotkey activity (Crtl + pgdn (SpecialKey)) after saving the image.

Add that in and it will work.

Hey TimK… It’s working absolutely fine. Thank You very much.

@khan
In my sample workflow, I just took the condition as <=5 as Excel has 5 sheets in it.
For a dynamic excel sheet, u can make a condition as while it contains sheets.
Try to build it in a try catch block.so, whenever the limit is reached it will throw the exception and you can catch those exceptions.