0

I am using the Fill.UserPicture property to change the image displayed in a shape but the image doesn't get redrawn/refreshed. If I manually right-click the shape and do Change Picture and then paste in the same path and file name (copied from the VBA) it works.

this SO page says that it worked for them

Any reason why this might be?

I have tried making the Fill not visible first. I'm using Excel 2016.

EDIT: Added the code

Dim shpImage As Shape
Dim sNewImagePathAndName As String

sNewImagePathAndName = GetImageFromWebsite(sLineNumber)

Set shpImage = ThisWorkbook.Worksheets("Images").Shapes("shpTemplateImage")

With shpImage
    If sNewImagePathAndName <> vbNullString Then
        .Fill.Visible = msoFalse
        .Fill.UserPicture PictureFile:=sNewImagePathAndName
        Debug.Print sNewImagePathAndName
        .Fill.Visible = msoTrue
    End If
End With

Example of sNewImagePathAndName: "H:\My Documents\Project One\Development\Visual Stock Pack\TS03N50NBLK_Large_F_1.jpg"

Community
  • 1
  • 1
ChipsLetten
  • 2,923
  • 1
  • 11
  • 28

0 Answers0