Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It sounds like the imageRange is not getting updated for the additional
pictures: With Worksheets("pietersplayground").Range(imageRange). Offset(i * 14, 0) You may need to Set imageRange = Range(includes new pix) Mike F "pepsinmentos" wrote in message ... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I do include the new pics in the range :P The problem is the 'type'. For some
reason VBA does not acknowledge the fact that the images are of the type 'Pictures'. Is there any way to convert images to make them 'Pictures'?? "Mike Fogleman" wrote: It sounds like the imageRange is not getting updated for the additional pictures: With Worksheets("pietersplayground").Range(imageRange). Offset(i * 14, 0) You may need to Set imageRange = Range(includes new pix) Mike F "pepsinmentos" wrote in message ... 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I don't know the answer to this one.
Sorry, Mike F "pepsinmentos" wrote in message ... I do include the new pics in the range :P The problem is the 'type'. For some reason VBA does not acknowledge the fact that the images are of the type 'Pictures'. Is there any way to convert images to make them 'Pictures'?? "Mike Fogleman" wrote: It sounds like the imageRange is not getting updated for the additional pictures: With Worksheets("pietersplayground").Range(imageRange). Offset(i * 14, 0) You may need to Set imageRange = Range(includes new pix) Mike F "pepsinmentos" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
runtime error '1004' application or object defined error | Excel Programming | |||
runtime error '1004' application or object defined error. Please help | Excel Programming | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
Syntax Error Runtime Error '424' Object Required | Excel Programming | |||
Add pictures to UserForm at runtime | Excel Programming |