Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: cycling picture on dialog box

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Take a look at the LoadPicture function (Or method ?). You have it already... only need to add this part.
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  3. #3
    New Member
    Join Date
    Mar 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    That did the trick.. just changed all my picture assignment lines to

    portion.Picture = LoadPicture(strpath & "x/x.bmp")

    Many thanks!

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •