Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Controlling and setting images

I am trying to control various images in excel, showing a
different image depending on the value in some cells.
However I am having problem dynamically setting the image
object I wish to refer to. For example, the following
will work:

Dim imgtest As Image
Set imgtest = ThisWorkbook.Sheets(1).Image1
Image1.Picture.... etc

But when I try to set Image1 dynamically it won't work:

Dim imgtest as image
set imgtest = ThisWorkbook.sheets(1).Image("Image" &
intImageCount)

where intImageCount is equal to 1.

Also if I try to dim imgtest as shape and set using shape
("Image" & intImageCount) I also have no joy.

Any help appreciated.

Cheers

Sean
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Controlling and setting images

Sean,

You must have joy! Here is a sample that I used everytime the cursor moved,
I check if it is an a cell that contains the name of an picture (and was in
a certain range called "Images"). Then (the part you really care about) I
used the LOADPICTURE method off of my Image control (named picImage) to
change the picture.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

On Error GoTo Exception

If Not Intersect(Target, Target.Worksheet.ListObjects(1).Range) Is
Nothing Then
With Me.picImage
.Picture = LoadPicture(ThisWorkbook.Path & "\Images\" &
Intersect(Target.EntireRow, Range("Images")).Resize(1, 1).Value)
.Visible = True
End With
Else
Me.picImage.Visible = False
End If
Finally:
Exit Sub

Exception:
Me.picImage.Visible = False
Resume Finally

End Sub

______________

I hope joy is reestablished....

--
Charles
www.officezealot.com


"Sean Benson" wrote in message
...
I am trying to control various images in excel, showing a
different image depending on the value in some cells.
However I am having problem dynamically setting the image
object I wish to refer to. For example, the following
will work:

Dim imgtest As Image
Set imgtest = ThisWorkbook.Sheets(1).Image1
Image1.Picture.... etc

But when I try to set Image1 dynamically it won't work:

Dim imgtest as image
set imgtest = ThisWorkbook.sheets(1).Image("Image" &
intImageCount)

where intImageCount is equal to 1.

Also if I try to dim imgtest as shape and set using shape
("Image" & intImageCount) I also have no joy.

Any help appreciated.

Cheers

Sean



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Controlling and setting images

Charles

Not quite reached that Eureka moment yet...

The problem is I have a lot of image controls on my form,
named for example picimage, picimage1, picimage2,
picimage3 etc. and yes I could use the loadpicture method
but I would have to use it for every image control and
more importantly under every scenario that these images
needed to change.

I was hoping to loop through these image controls but I
don't seem to be able to declare a variable "picimage &
int" kind of thing.

Any further suggestions?

Cheers

Sean
-----Original Message-----
Sean,

You must have joy! Here is a sample that I used

everytime the cursor moved,
I check if it is an a cell that contains the name of an

picture (and was in
a certain range called "Images"). Then (the part you

really care about) I
used the LOADPICTURE method off of my Image control

(named picImage) to
change the picture.


Private Sub Worksheet_SelectionChange(ByVal Target As

Range)

On Error GoTo Exception

If Not Intersect(Target,

Target.Worksheet.ListObjects(1).Range) Is
Nothing Then
With Me.picImage
.Picture = LoadPicture(ThisWorkbook.Path

& "\Images\" &
Intersect(Target.EntireRow, Range("Images")).Resize(1,

1).Value)
.Visible = True
End With
Else
Me.picImage.Visible = False
End If
Finally:
Exit Sub

Exception:
Me.picImage.Visible = False
Resume Finally

End Sub

______________

I hope joy is reestablished....

--
Charles
www.officezealot.com


"Sean Benson"

wrote in message
...
I am trying to control various images in excel,

showing a
different image depending on the value in some cells.
However I am having problem dynamically setting the

image
object I wish to refer to. For example, the following
will work:

Dim imgtest As Image
Set imgtest = ThisWorkbook.Sheets(1).Image1
Image1.Picture.... etc

But when I try to set Image1 dynamically it won't work:

Dim imgtest as image
set imgtest = ThisWorkbook.sheets(1).Image("Image"

&
intImageCount)

where intImageCount is equal to 1.

Also if I try to dim imgtest as shape and set using

shape
("Image" & intImageCount) I also have no joy.

Any help appreciated.

Cheers

Sean



.

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
Chart.Export images are shrinking as I export more images Jared Charts and Charting in Excel 3 January 29th 08 03:23 AM
Controlling Userforms harrysfan New Users to Excel 1 August 30th 06 12:47 PM
Controlling Sequence HS Excel Discussion (Misc queries) 0 March 15th 05 02:15 PM
Setting default pivot table field setting to "sum" Mr. Moose Excel Discussion (Misc queries) 2 December 21st 04 04:43 PM
Controlling the mouse Brian Sharf Excel Programming 1 July 21st 03 08:24 AM


All times are GMT +1. The time now is 11:13 PM.

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

About Us

"It's about Microsoft Excel"