Word vba fill shape with userpicture assigned to a string variable
Evil Devil
1
Reputation point
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!