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

activities

#1

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.


#2
  • 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)


#3

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.


#4

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


#5

Main (9).xaml (8.7 KB)


#6

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


#7

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


#8

@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)


#9

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.


#10

It is taking the same screenshot with different name only.


#11

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


#12

Hi,

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

Add that in and it will work.


#13

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


#14

@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.