EvilDevil-3807 avatar image
0 Votes"
EvilDevil-3807 asked EvilDevil-3807 commented

Word vba fill shape with userpicture assigned to a string variable

Hi all,

This question has been asked before here :

back in 2012 but it doesn't seem to solve my problem. I have office 2016 here and the bug still persists. If i use

 shp.Fill.UserPicture "C:/.../somepicture.png"

it works but if I do

 Dim myStr as string
 myStr = "C:/.../somepicture.png"
 shp.Fill.UserPicture myStr

it throws an error: method 'UserPicture' of object 'FillFormat' failed
The same goes for Dir() function. When supplied a variable instead of a string literal, it throws error: Bad file name or number
please note, shp is dimmed as Shape and I am loopimg through AtiveDocument.Shapes for each shp

Would really appreciate if somebody could help!

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

It seems to work in case of simple documents. Maybe the issue depends on document content.

0 Votes 0 ·

I did this on a new document with only a rectangle shape. I don't see a document any simpler than that.

0 Votes 0 ·

0 Answers