Thread: [Solved] change the image by clicking
View Single Post
 
Old 03-23-2019, 01:46 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,138
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

On further reflection, you can use the same label e.g.
Code:
Private Sub UserForm_Initialize()
    Label1.Picture = LoadPicture("D:\My Pictures\Image_1.bmp")
    Label1.Caption = "Image1"
    Label1.ForeColor = Label1.BackColor
End Sub

Private Sub CommandButton1_Click()
    If Label1.Caption = "Image1" Then
        Label1.Picture = LoadPicture("D:\My Pictures\Image_2.bmp")
        Label1.Caption = "Image2"
    Else
        Label1.Picture = LoadPicture("D:\My Pictures\Image_1.bmp")
        Label1.Caption = "Image1"
    End If
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote