Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Pictures runtime error using VBA

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Pictures runtime error using VBA

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Pictures runtime error using VBA

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime error '1004' application or object defined error Janis Excel Programming 4 November 18th 09 03:01 PM
runtime error '1004' application or object defined error. Please help deej Excel Programming 0 August 1st 07 09:26 AM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM
Add pictures to UserForm at runtime Dave[_33_] Excel Programming 1 December 6th 03 06:22 PM


All times are GMT +1. The time now is 06:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"