Hello,
I need to insert an image to a word file.
First I have wrote the macro in VBA to insert image to a specific page in a word file
Then , I have tried to translate it in a Blue Prism action but it doesn't works.
The error shown is always the same even if I change the code
Someone can help me to fix it?
I need to insert an image to a word file.
First I have wrote the macro in VBA to insert image to a specific page in a word file
Code:
Sub InsertImage()
Dim PicPath As String
Dim aShape As Shape
PicPath = "C:\Users\f04959c\Desktop\Capture.PNG"
ActiveDocument.GoTo(What:=wdGoToPage, Count:=1).Select
Set aShape = Selection.InlineShapes.AddPicture(FileName:=PicPath, _
LinkToFile:=False, SaveWithDocument:=True).ConvertToShape
With aShape
.Height = 75
.Width = 100
.Left = 400
.Top = 5
End With
End Sub
Then , I have tried to translate it in a Blue Prism action but it doesn't works.
Code:
Dim doc as Object
doc = GetInstance(Handle).ActiveDocument.GoTo(What:=1, Count:=1)
with doc.InlineShapes.AddPicture(FileName:=PicPath, LinkToFile:=False, SaveWithDocument:=True).ConvertToShape
.Height = 75
.Width = 100
.Left = 400
.Top = 10
End With
The error shown is always the same even if I change the code
Internal : Could not execute code stage because exception thrown by code stage: Variabile oggetto o variabile del blocco With non impostata
Someone can help me to fix it?