On a document in Word there is a table in which I have put textboxes.
Now I want to add pictures to these textboxes.
I use the code written below. But, although pictures get written, they are placed outside the textboxes. How can I make sure that they are placed within the boxes?
Sub AfbeeldingenLaden()
Dim tekstvak As Shape
Dim Bestandsnamen()
As String
Dim i As
Integer
Bestandsnamen = AfbeeldingenKiezen()
For Each tekstvak
In ActiveDocument.Shapes
If tekstvak.Height
> 20 Then
tekstvak.Select
If Bestandsnamen(i)
<> ""
Then
Selection.InlineShapes.AddPicture
Bestandsnamen(i),
False, True
End
If
i
= i + 1
End If
Next
End Sub
I've also tried the following, but that gives a Type Mismatch error:
For Each tekstvak In ActiveDocument.Shapes
If tekstvak.Height
> 20 Then
tekstvak.Select
If Bestandsnamen(i)
<> ""
Then
Dim rng
As Word.Range Set rgn
= tekstvak.TextFrame.TextRange.Paragraphs(1).Range
ActiveDocument.InlineShapes.AddPicture FileName:=Bestandsnamen(i),
LinkToFile:=False, SaveWithDocument:=True, Range:=rng
End If
i = i
+ 1
End If
Next