Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default for i...next i over images in a sheet

i've 2 little problems i'm not able to solve.

i've to associate a specific picture to each images in my active sheet.
(the number of images may be variable depending on the number of
connected data).
let's say i want to associate a different picture to each of my images.

so i've created a list like that:

cell1 image1 - image1.picture= loadpicture (file1.gif)
cell2 image2 - image2.picture= loadpicture (file2.gif)
.......
.......
cell10 image10 - image10.picture= loadpicture (file10.gif)
.......
.......
cell100 image100 - image100.picture= loadpicture (file100.gif)

Question 1

i would like to write a routine with a for i... next command able to
associate the right file to each of my images...

the problem is that a routine like the following doesn't work:

Sub associate_immages()

Dim path As String
Dim i As Integer

Sheets("team").Select
For i = 1 To 20
path = Worksheets("team").Range("GW" & i + 1).Value
Activesheet."image" & i.picture = LoadPicture(path)
Next i
End Sub

i've tried also with

'Sheets("team").form("image" & i).picture = LoadPicture(path)

and

'Sheets("team").shapes("image" & i).picture = LoadPicture(path)

but again i've an error message.

how can i solve this problem??


Question 2

some of the images should not be associated with any picture leaving
the backstyle completely transparent....

how can i delete the previous picture (using the same routine as
before) leaving the image "empty" ??


thanks in advance for your help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default for i...next i over images in a sheet

Dim path As String
Dim i As Integer

Sheets("team").Select
For i = 1 To 20
path = Worksheets("team").Range("GW" & i + 1).Value
Activesheet.OleObjects("image" & i).Object.picture = LoadPicture(path)
Next i
End Sub


#2
Activesheet.OleObjects("image" & i).Object.picture = loadpicture("")


--
Regards,
Tom Ogilvy


"furbiuzzu" wrote in message
ups.com...
i've 2 little problems i'm not able to solve.

i've to associate a specific picture to each images in my active sheet.
(the number of images may be variable depending on the number of
connected data).
let's say i want to associate a different picture to each of my images.

so i've created a list like that:

cell1 image1 - image1.picture= loadpicture (file1.gif)
cell2 image2 - image2.picture= loadpicture (file2.gif)
......
......
cell10 image10 - image10.picture= loadpicture (file10.gif)
......
......
cell100 image100 - image100.picture= loadpicture (file100.gif)

Question 1

i would like to write a routine with a for i... next command able to
associate the right file to each of my images...

the problem is that a routine like the following doesn't work:

Sub associate_immages()

Dim path As String
Dim i As Integer

Sheets("team").Select
For i = 1 To 20
path = Worksheets("team").Range("GW" & i + 1).Value
Activesheet."image" & i.picture = LoadPicture(path)
Next i
End Sub

i've tried also with

'Sheets("team").form("image" & i).picture = LoadPicture(path)

and

'Sheets("team").shapes("image" & i).picture = LoadPicture(path)

but again i've an error message.

how can i solve this problem??


Question 2

some of the images should not be associated with any picture leaving
the backstyle completely transparent....

how can i delete the previous picture (using the same routine as
before) leaving the image "empty" ??


thanks in advance for your help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default for i...next i over images in a sheet


Tom Ogilvy ha scritto:

Dim path As String
Dim i As Integer

Sheets("team").Select
For i = 1 To 20
path = Worksheets("team").Range("GW" & i + 1).Value
Activesheet.OleObjects("image" & i).Object.picture = LoadPicture(path)
Next i
End Sub


#2
Activesheet.OleObjects("image" & i).Object.picture = loadpicture("")


--
Regards,
Tom Ogilvy



thanks a lot !!!

i'll try it as soon as possible, now i'm not at home.

but i've encountered another problem in the command

Loadpicture(path)

the variable path as you can see is related with a cell where i merge
the "s before and after the "real" path.... do you think i'll encounter
the same problem with your code lines?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default for i...next i over images in a sheet

My code didn't alter any other part of what you posted, so it should behave
no differently.

You shouldn't be adding double quotes around the path string.

spath = Activecell.Value

not
spath = """" & ActiveCell.Value & """"

--
Regards,
Tom Ogilvy

"furbiuzzu" wrote in message
ups.com...

Tom Ogilvy ha scritto:

Dim path As String
Dim i As Integer

Sheets("team").Select
For i = 1 To 20
path = Worksheets("team").Range("GW" & i + 1).Value
Activesheet.OleObjects("image" & i).Object.picture = LoadPicture(path)
Next i
End Sub


#2
Activesheet.OleObjects("image" & i).Object.picture = loadpicture("")


--
Regards,
Tom Ogilvy



thanks a lot !!!

i'll try it as soon as possible, now i'm not at home.

but i've encountered another problem in the command

Loadpicture(path)

the variable path as you can see is related with a cell where i merge
the "s before and after the "real" path.... do you think i'll encounter
the same problem with your code lines?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default for i...next i over images in a sheet


Tom Ogilvy ha scritto:

My code didn't alter any other part of what you posted, so it should behave
no differently.

You shouldn't be adding double quotes around the path string.

spath = Activecell.Value

not
spath = """" & ActiveCell.Value & """"

--
Regards,
Tom Ogilvy


problem solved!
thanks again!

regards,
Fulvio Salvo

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
how do i sort a data sheet which has images in it also? Arpit Gupta Excel Discussion (Misc queries) 2 September 12th 08 12:43 AM
Chart.Export images are shrinking as I export more images Jared Charts and Charting in Excel 3 January 29th 08 03:23 AM
delete images in an excel sheet [email protected] Excel Programming 2 June 14th 06 06:51 PM
*.gif images Mischa Browne[_2_] Excel Programming 4 July 16th 04 03:18 PM
VBA code to insert images in excel sheet Riya Excel Programming 2 October 29th 03 12:22 PM


All times are GMT +1. The time now is 03:31 AM.

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"