Fill imagebox in userform with a specified picture from a document

V

vicenflor

Hello,

I have the following problem. I have inserted a total of 6 pictures into
specified cells of a table in word. To achieve this, I use the code below and
this is running OK :

'row = 6
'column = 2

Set rgDest = Selection.Tables(1).Cell(row, column).Range

Set shpShape = ActiveDocument.Shapes.AddPicture _
(FileName:=StrFile, LinkToFile:=True, _
SaveWithDocument:=False, Anchor:=rgDest)

With shpShape
.Name = "photo1"
.LockAnchor = True
.LockAspectRatio = msoTrue

.Height = CentimetersToPoints(6.65)
.Left = CentimetersToPoints(-0.2)

End With

The problem now is : I want to select each of these pictures and place it in
one of the 6 imageboxes of a userform. This is possible by the code :

set userform1.photo1.picture = loadpicture(strfile), but for some reasons I
want to fill the imageboxes based on the name (for instance "photo1" in my
example) or another identifier of the shape in my document. I only need to be
sure to pick the photo in my document and place it in the correct imagebox of
my userform.

Can anybody help me with this?

Thanks,
Vicenflor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top