Wllian_Santos
New Member
Hi, there a way to change the image on userform when i select another name in listbox?
I have a shape that change on the worksheet when i select a name in listbox, but on Userform only change when i initialize.
Here the code on the project:
>>> use code - tags <<<
Excel 365, Windows, System 64, Notebook
I have a shape that change on the worksheet when i select a name in listbox, but on Userform only change when i initialize.
Here the code on the project:
>>> use code - tags <<<
Code:
Private Sub UserForm_Initialize()
Dim cObj As ChartObject, iPath
Application.ScreenUpdating = False
With ActiveSheet.Shapes("Imagem 1")
Set cObj = ActiveSheet.ChartObjects.Add(.Left, .Top, .Width, .Height)
.Copy: cObj.Select: cObj.Chart.Paste
iPath = Environ("Temp") & "\" & Format(Now, "hhmmss") & ".jpg"
cObj.Chart.Export iPath
End With
Image1.Picture = LoadPicture(iPath)
cObj.Delete
End Sub
Excel 365, Windows, System 64, Notebook
Attachments
Last edited by a moderator: