cancel
Showing results for 
Search instead for 
Did you mean: 

How to Take Excel sheet screenshot using BluePrism

Abhi-Chattar
Verified Partner

Hi Team,

We have a requirement to take Excel sheet body screenshot.

If anyone worked on this type of requirement. Please share your thoughts here.

we tried to use global send keys (send hot keys) but, didn't get any result

AbhiChattar_1-1751998115829.png

Above image is for reference , we want like this screenshot.

Thanks.

 

2 REPLIES 2

To take a screenshot, you can build a quick Screenshot utility.

Refer to this thread for the same.

Hi @Abhi-Chattar 

Please find the below custom code for taking screenshot of specified range from excel,

SayeedBinAbdullah_4-1752046804169.png

 

SayeedBinAbdullah_0-1752046556131.png

 

SayeedBinAbdullah_3-1752046723876.png

Code To Paste as action in Excel VBO

<process name="__selection__MS Excel VBO - Extended" type="object">
  <subsheet subsheetid="79c86942-907e-49a6-b9ba-81f9983ee3d4" type="Normal" published="True">
    <name>Take Screenshot of Worksheet</name>
    <view>
      <camerax>-157</camerax>
      <cameray>-11</cameray>
      <zoom version="2">1.25</zoom>
    </view>
  </subsheet>
  <stage stageid="126e45cc-1e0a-4990-9e87-e1b3c08abaf9" name="Take Screenshot of Worksheet" type="SubSheetInfo">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <loginhibit onsuccess="true" />
    <display x="-255" y="-150" w="150" h="90" />
  </stage>
  <stage stageid="a6b1d797-c9ef-4970-aedd-3362caade9b2" name="Start" type="Start">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <loginhibit onsuccess="true" />
    <display x="-60" y="-180" />
    <inputs>
      <input type="text" name="Workbook Name" narrative="The name of the workbook in which the sheet exists." stage="Workbook name" />
      <input type="text" name="Worksheet Name" narrative="The name of the sheet which should be activated." stage="Worksheet name" />
      <input type="number" name="handle" narrative="The integer handle identifying the instance on which the worksheet which should be activated resides. " stage="handle" />
      <input type="text" name="Cell reference" stage="Cellref" />
      <input type="text" name="Image Path" stage="outputPath" />
      <input type="text" name="Range" stage="excel_range" />
    </inputs>
    <onsuccess>f590d27f-4248-44ed-9115-99146bd7ded7</onsuccess>
  </stage>
  <stage stageid="f590d27f-4248-44ed-9115-99146bd7ded7" name="Screenshot of Worksheet" type="Code">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <loginhibit onsuccess="true" />
    <display x="-60" y="-105" />
    <inputs>
      <input type="text" name="Workbookname" expr="[Workbook name]" />
      <input type="text" name="Worksheetname" expr="[Worksheet name]" />
      <input type="flag" name="Createifmissing" expr="[createifmissing]" />
      <input type="number" name="handle" expr="[handle]" />
      <input type="text" name="excel_range" expr="[excel_range]" />
      <input type="text" name="outputPath" expr="[outputPath]" />
    </inputs>
    <outputs>
      <output type="flag" name="Success" stage="Success" />
      <output type="text" name="Message" stage="Message" />
      <output type="flag" name="sheetexists" stage="sheetexists" />
    </outputs>
    <onsuccess>f058cc41-b545-4a0d-b0da-44866911aa34</onsuccess>
    <code><![CDATA[Dim ws as Object = GetWorksheet(handle,workbookname,worksheetname,createifmissing)
sheetexists = ws IsNot Nothing 
 
Try
 
If sheetexists then 
ws.Activate()
Dim range As Microsoft.Office.Interop.Excel.Range = CType(ws.Range(excel_range), Microsoft.Office.Interop.Excel.Range)
 
 
        ' Copy as picture to clipboard
range.CopyPicture(Excel.XlPictureAppearance.xlScreen, Excel.XlCopyPictureFormat.xlBitmap)
 
        ' Wait for clipboard to be populated
        Threading.Thread.Sleep(1000)
 
        If Clipboard.ContainsImage() Then
            Dim img As Image = Clipboard.GetImage()
            img.Save(outputPath, Imaging.ImageFormat.Png)
        End If
End If
            Success = True
 
Catch e As Exception
Success = False
Message = e.Message
End Try]]></code>
  </stage>
  <stage stageid="299d3901-a2f2-4887-b883-ee0689cf903c" name="Workbook name" type="Data">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <loginhibit onsuccess="true" />
    <display x="-300" y="-15" w="120" h="30" />
    <datatype>text</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="4e31a3db-9a9d-4752-8505-2eb29de13e80" name="Worksheet name" type="Data">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <loginhibit onsuccess="true" />
    <display x="-300" y="15" w="120" h="30" />
    <datatype>text</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="ddd8738d-0a4e-4e09-b943-e8e137cabdae" name="Cellref" type="Data">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <loginhibit onsuccess="true" />
    <display x="-300" y="135" w="120" h="30" />
    <datatype>text</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="2850c03d-80a6-4d7b-a281-acd4e9470c4e" name="Image" type="Data">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <loginhibit onsuccess="true" />
    <display x="-300" y="45" w="120" h="30" />
    <datatype>text</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="3e318712-b5b7-4fb0-a567-c41ab41f670f" name="createifmissing" type="Data">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <loginhibit onsuccess="true" />
    <display x="-300" y="75" w="120" h="30" />
    <datatype>flag</datatype>
    <initialvalue>False</initialvalue>
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="5260124a-e9ca-42c0-8829-b5ef11978493" name="handle" type="Data">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <loginhibit onsuccess="true" />
    <display x="-300" y="105" w="120" h="30" />
    <datatype>number</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="8106969e-bdfb-4a93-b844-48ce34580dc1" name="sheetexists" type="Data">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <loginhibit onsuccess="true" />
    <display x="-165" y="-15" w="120" h="30" />
    <datatype>flag</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="f058cc41-b545-4a0d-b0da-44866911aa34" name="End" type="End">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <loginhibit onsuccess="true" />
    <display x="-60" y="-15" />
    <font family="Tahoma" size="10" style="Regular" color="000000" />
    <outputs>
      <output type="flag" name="Success" stage="Success" />
      <output type="text" name="Message" stage="Message" />
    </outputs>
  </stage>
  <stage stageid="b65c9c94-75c3-468f-a973-c71d85c4464a" name="excel_range" type="Data">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <display x="-165" y="15" w="120" h="30" />
    <datatype>text</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="15ed13d2-b4b6-4961-8ed1-4d8799aedc89" name="outputPath" type="Data">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <loginhibit />
    <display x="-165" y="45" w="120" h="30" />
    <datatype>text</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="eb89ed27-cbb0-4516-a3d8-2814e8bde85f" name="Success" type="Data">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <display x="15" y="-105" />
    <datatype>flag</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
  <stage stageid="8c56773d-cad8-4a9b-94b8-75e50ad815a7" name="Message" type="Data">
    <subsheetid>79c86942-907e-49a6-b9ba-81f9983ee3d4</subsheetid>
    <display x="90" y="-105" />
    <datatype>text</datatype>
    <initialvalue />
    <private />
    <alwaysinit />
  </stage>
</process>
 
Best Regards,
Sayeed Bin Abdullah