Extraction of inserted image objects from Excel using uipath

Hi All,

I have some image installed in excel as objects. i need to extarct them through uipatt.Can you please help me on this query.

Thanks in advance

Hi, use VBA macros and “Invoke VBA” activity for solve this task.

1 Like

@Ivanco , will we able extract the objects through VBA code?

@Akshay_Kumar2 Please have a look https://stackoverflow.com/questions/35223247/how-extract-images-from-excel-sheets

2 Likes

@Arpit_Kesharwani, thanks for the Link. Code in this link will work if my excel is having image. but my scenario is to extract the package/object(image been loaded as package) from excel.

@Akshay_Kumar2 Above link will be able to get not only image objects but all the objects from the Excel.

@Akshay_Kumar2 “image been loaded as package” - what does it mean? please attach your excel file for exemple.

@Arpit_Kesharwani, i have run the code for my excel, but no image’s are getting extracted.

@Ivanco, i have attached the sample input file. B2,B3,B4 column’s are having the objects.Book1.xlsx (1.1 MB)

Sub ExtractOle()
    Dim Ws As Worksheet
    Set Ws = ThisWorkbook.Sheets(1)
    Shell "explorer.exe " & "C:\test", vbNormalFocus
    Application.CutCopyMode = False
    Dim ole As OLEObject
    For Each ole In Ws.OLEObjects
        ole.Copy
        Application.Wait Now() + TimeSerial(0, 0, 3)
        Application.SendKeys "^v"
        Application.Wait Now() + TimeSerial(0, 0, 3)
    Next ole
    Application.CutCopyMode = False
End Sub

@Akshay_Kumar2 it is OLE objects.
See code, is not the best solution, I think. but it works.
You must add your path for save, and change wait time for big pictures.
by stackoverflow

2 Likes

@Akshay_Kumar2 code above works? if “yes” mark post as a solution.