View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
pepsinmentos pepsinmentos is offline
external usenet poster
 
Posts: 4
Default Pictures runtime error using VBA

I'm using VBA in Excel 2003 to look up pictures based on a table of values,
and then display the picture that corrosponds with the value in the table. I
used the McGimpsey & Associates link that the users on this forum refer to
when someone asks the question about looking up pictures:
http://www.mcgimpsey.com/excel/lookuppics.html
I used the method and it worked like a dream!

I went on programming other things and had to add new/extra pictures to my
existing 'database'. The problem is, now everytime I select the value to
display one of the new pictures, I get a run-time error saying 'Error 13:
Type mismatch'

The old pictures work perfectly fine, but the new ones give me the resulting
error. Can anyone help?

(Here is my code)

Dim i As Integer

Dim oPic As Picture
Me.Pictures.Visible = True
Me.CommandButton1.Visible = True

Do While i <= countInt
With Worksheets("pietersplayground").Range(imageRange). Offset(i *
14, 0)
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = .Offset(1, 0).Top
oPic.Left = .Offset(1, 0).Left
Exit For
End If
Next oPic
End With
i = i + 1
Loop