sheet.Shapes.AddPicture (Filename:=PicturePath, LinkToFile:=0, _
SaveWithDocument:= -1, Left:=cellLeft, Top:=cellTop, Width:=-1, Height:=-1)
Dim sw, dw As Object
Dim ss, ds As Object
Dim excel, sheet As Object
dim cellLeft, cellTop as integer
Try
sw = GetWorkbook(Handle, Source_Workbook)
ss = GetWorksheet(Handle, Source_Workbook, Source_Worksheet)
sw.Activate()
ss.Activate()
excel = ss.Application
sheet = excel.ActiveSheet
sheet.Range(Cell_to_Paste_in).select()
Dim cell as Object = excel.ActiveCell
cellLeft = cell.Left
cellTop = cell.Top
sheet.Shapes.AddPicture (Filename:=PicturePath, LinkToFile:=0, _
SaveWithDocument:= -1, Left:=cellLeft, Top:=cellTop, Width:=-1, Height:=-1)
Success = True
Catch e As Exception
Success = False
Message = e.Message
Finally
sw = Nothing
ss = Nothing
dw = Nothing
ds = Nothing
excel = Nothing
sheet = Nothing
End Try
Hi afzal29,Hi , i am getting error "The given key was not present in the dictionary." when i run code stage, could you please help.View attachment 1135
Thanks , it is working now.Hi afzal29,
The Source Workbook data item should not be "Book 1" but in the format FileName.xlsx.
Either it needs to be an existing file or a new file that is saved so that Blue Prism will know where to paste the image.
Hi radhavydehig,
You will need to create a new action in the Ms Excel VBO.
Here is the Code stage for it.
Code:Dim sw, dw As Object Dim ss, ds As Object Dim excel, sheet As Object dim cellLeft, cellTop as integer Try sw = GetWorkbook(Handle, Source_Workbook) ss = GetWorksheet(Handle, Source_Workbook, Source_Worksheet) sw.Activate() ss.Activate() excel = ss.Application sheet = excel.ActiveSheet sheet.Range(Cell_to_Paste_in).select() Dim cell as Object = excel.ActiveCell cellLeft = cell.Left cellTop = cell.Top sheet.Shapes.AddPicture (Filename:=PicturePath, LinkToFile:=0, _ SaveWithDocument:= -1, Left:=cellLeft, Top:=cellTop, Width:=-1, Height:=-1) Success = True Catch e As Exception Success = False Message = e.Message Finally sw = Nothing ss = Nothing dw = Nothing ds = Nothing excel = Nothing sheet = Nothing End Try
Refer to the file names for the explanation of the below attachments.
Did you mentioned workbook path...Hi,
I am getting compilation error in code stage. Can u please let me know what is that i am missing. PFA the Issue Attachment
Hi BP_2018,Hi,
I am getting compilation error in code stage. Can u please let me know what is that i am missing. PFA the Issue Attachment
Hi BP_2018,Hi,
When i try to test the copy image to excel code in MS EXCEL VBO i am getting the following error "Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))" PFA the screenshot.