heatdav
07-24-2012, 12:45 AM
Hi. I've created a very simple userform that only contains an image (image1) and a checkbox (checkbox1). I want to load and unload a picture via a checkbox. I wrote the following code, which works fine if I just click the checkbox on and off.
However, if I click on the image box at any point, the checkbox no longer works (i.e. the image stays in the state it was previously and won't change when I click the checkbox anymore).
I'm sure this is something super-simple I'm missing, but any help would be appreciated. My code is below...
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
UserForm1.Image1.Picture = LoadPicture("D:\Storage\Test.jpg")
Else
UserForm1.Image1.Picture = LoadPicture("")
End If
End Sub
However, if I click on the image box at any point, the checkbox no longer works (i.e. the image stays in the state it was previously and won't change when I click the checkbox anymore).
I'm sure this is something super-simple I'm missing, but any help would be appreciated. My code is below...
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
UserForm1.Image1.Picture = LoadPicture("D:\Storage\Test.jpg")
Else
UserForm1.Image1.Picture = LoadPicture("")
End If
End Sub