Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Variable as subject of SET

Hello,
I,m trying to place an image, that is in worksheet, to user form. I menaged
to do it by copying it to clipboard and than taking it from there to user
form. Everything works fine, but I want to go step forward. What i'm trying
to do is to place picture but name of the picture depends from the option
user will chose. The problem is that I use SET to chose which picture is
copied.
Code looks like this:

set pic=sheet1.image1

this is examle for one picture, but I can't do it for random name:

for example name is:

name="sheet1.image" & i

and for this case it doesen't work, please help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Variable as subject of SET

Set pic = sheet1.Shapes("image " & 1)

--
__________________________________
HTH

Bob

"Lucas" wrote in message
...
Hello,
I,m trying to place an image, that is in worksheet, to user form. I
menaged
to do it by copying it to clipboard and than taking it from there to user
form. Everything works fine, but I want to go step forward. What i'm
trying
to do is to place picture but name of the picture depends from the option
user will chose. The problem is that I use SET to chose which picture is
copied.
Code looks like this:

set pic=sheet1.image1

this is examle for one picture, but I can't do it for random name:

for example name is:

name="sheet1.image" & i

and for this case it doesen't work, please help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Variable as subject of SET

For ideas -

Private Sub UserForm_Click()
Dim sOlePic As String
Dim ole As OLEObject

sOlePic = "Image1" ' name of the image control on the sheet

Set ole = ActiveWorkbook.Worksheets("Sheet1").OLEObjects(sOl ePic)
Set Me.Image1.Picture = ole.Object.Picture
Me.Image1.AutoSize = True

End Sub

Regards,
Peter T

"Lucas" wrote in message
...
Hello,
I,m trying to place an image, that is in worksheet, to user form. I

menaged
to do it by copying it to clipboard and than taking it from there to user
form. Everything works fine, but I want to go step forward. What i'm

trying
to do is to place picture but name of the picture depends from the option
user will chose. The problem is that I use SET to chose which picture is
copied.
Code looks like this:

set pic=sheet1.image1

this is examle for one picture, but I can't do it for random name:

for example name is:

name="sheet1.image" & i

and for this case it doesen't work, please help.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Variable as subject of SET

Works fine,

Than You Both for help.

Regards Lucas

€˛Peter T€¯ pisze:

For ideas -

Private Sub UserForm_Click()
Dim sOlePic As String
Dim ole As OLEObject

sOlePic = "Image1" ' name of the image control on the sheet

Set ole = ActiveWorkbook.Worksheets("Sheet1").OLEObjects(sOl ePic)
Set Me.Image1.Picture = ole.Object.Picture
Me.Image1.AutoSize = True

End Sub

Regards,
Peter T

"Lucas" wrote in message
...
Hello,
I,m trying to place an image, that is in worksheet, to user form. I

menaged
to do it by copying it to clipboard and than taking it from there to user
form. Everything works fine, but I want to go step forward. What i'm

trying
to do is to place picture but name of the picture depends from the option
user will chose. The problem is that I use SET to chose which picture is
copied.
Code looks like this:

set pic=sheet1.image1

this is examle for one picture, but I can't do it for random name:

for example name is:

name="sheet1.image" & i

and for this case it doesen't work, please help.




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
No Subject No Name Excel Worksheet Functions 0 April 2nd 09 02:27 AM
No Subject No Name Excel Worksheet Functions 0 April 1st 09 07:55 PM
No Subject Excel Worksheet Functions 0 April 5th 05 12:00 AM
No Subject Excel Worksheet Functions 0 January 25th 05 12:00 AM
No Subject Excel Discussion (Misc queries) 0 January 24th 05 12:00 AM


All times are GMT +1. The time now is 02:33 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"