Im trying to insert a picture that will cycle through 4 different bmp files when clicked in a dialog box. My code so far is as follows:
Private Sub portion_Click()
strpath = Application.ThisWorkbook.Path & Application.PathSeparator
If Fraction = 3 Then
portion.Picture = strpath & "1/4.bmp"
Fraction = 0
ElseIf Fraction = 0 Then
portion.Picture = strpath & "1/2.bmp"
Fraction = 1
ElseIf Fraction = 1 Then
portion.Picture = strpath & "3/4.bmp"
Fraction = 2
ElseIf Fraction = 2 Then
portion.Picture = strpath & "full.bmp"
Fraction = 3
End If
End Sub
...but when I click it, I get a runtime error 424: object required on the
portion.Picture = strpath & "1/2.bmp"
line (since fraction's default value is 0). I have checked the strpath variable and it is correct, and the files (1/2.bmp, etc) do exist. What am I missing??
Private Sub portion_Click()
strpath = Application.ThisWorkbook.Path & Application.PathSeparator
If Fraction = 3 Then
portion.Picture = strpath & "1/4.bmp"
Fraction = 0
ElseIf Fraction = 0 Then
portion.Picture = strpath & "1/2.bmp"
Fraction = 1
ElseIf Fraction = 1 Then
portion.Picture = strpath & "3/4.bmp"
Fraction = 2
ElseIf Fraction = 2 Then
portion.Picture = strpath & "full.bmp"
Fraction = 3
End If
End Sub
...but when I click it, I get a runtime error 424: object required on the
portion.Picture = strpath & "1/2.bmp"
line (since fraction's default value is 0). I have checked the strpath variable and it is correct, and the files (1/2.bmp, etc) do exist. What am I missing??