![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 2
|
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?? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
|
Take a look at the LoadPicture function (Or method ?). You have it already... only need to add this part.
|
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Posts: 2
|
That did the trick.. just changed all my picture assignment lines to
portion.Picture = LoadPicture(strpath & "x/x.bmp") Many thanks! |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|