+ Reply to Thread
Results 1 to 15 of 15

Get image shape from a sheet to image control in another sheet

  1. #1
    Forum Contributor
    Join Date
    07-15-2016
    Location
    Maputo, Mozambique
    MS-Off Ver
    2007
    Posts
    108

    Question Get image shape from a sheet to image control in another sheet

    Hi EXCELlent people!
    I am working on a recipes workbook and I need to ask for your help in order to retreive an image (shape) from a sheet and show it into another one.

    I'll explain... I have a sheet with a "database" containing the name, category, author, ingredients, preparation, date inserted and a photo of each recipe.

    I inserted all the data in the sheet via userform.

    So I have a nice long list of recipes, one per row, with a photo for each recipe in the last column (column 7 or G).

    I am already able to get all the values of each recipe in another sheet into textboxes, calling from a populated combobox dropdown list with the recipes names.

    But I can't figure out how to get the right photo for each recipe when showing the data.....

    Please Login or Register  to view this content.
    Until now I can only show the first photo.... how can I get the right picture for every recipe I'll call from the combobox?

    Any help will be really appreciated.


    PS I tried to post here early in the morning but my post did not shows up until now.... may be I did something wrong... sorry if is double. My bad...

    Yesterday morning I asked for help on MrExcel.com but nobody answered me. After spending almost all night searching online for a solution by myself, early this morning I also asked here on Excelforum.com. Same luck... nobody answered me.

    HTML Code: 
    HTML Code: 
    As I like ozgrid and I visited a lot before I decided to register there and ask there.
    Actually I thought cross-posting was asking a question in another member post. I am really sorry about all of this.
    Last edited by Alex Piotto; 03-11-2018 at 11:01 AM. Reason: aading my crossposting... sorry!

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,647

    Re: Get image shape from a sheet to image control in another sheet

    Rule 08: Cross-posting Without Telling Us

    Your post does not comply with Rule 8 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question. If you have fewer than 10 posts here, you will not be able to post a link, but you must still tell us where else you have asked the question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    No further help to be offered, please, until the OP has complied with this request.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    07-15-2016
    Location
    Maputo, Mozambique
    MS-Off Ver
    2007
    Posts
    108

    Re: Get image shape from a sheet to image control in another sheet

    Excuse me Miss AliGW... and sorry to everybody for my act of stupid desperation. Do I still have any chance to get help or I am already buried?
    I have added my "confession" in my first post...
    Last edited by Alex Piotto; 03-11-2018 at 10:58 AM.

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Get image shape from a sheet to image control in another sheet

    Can you post an example file with some images and the sheet with textboxes etc..
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Contributor
    Join Date
    07-15-2016
    Location
    Maputo, Mozambique
    MS-Off Ver
    2007
    Posts
    108

    Re: Get image shape from a sheet to image control in another sheet

    Hi bakerman2 and thanks for answer me. I will post in a few minutes

  6. #6
    Forum Contributor
    Join Date
    07-15-2016
    Location
    Maputo, Mozambique
    MS-Off Ver
    2007
    Posts
    108

    Re: Get image shape from a sheet to image control in another sheet

    I have to warn that the recipes book is in Italian.... what else? )
    There is only one recipe because of the file size... you will have to kindly insert another couple of recipes to test it.
    Click the button "INSERIRE NUOVA RICETTA" and fill the fields... Ingredients must be inserted before final submission in the list... and if you do not load a foto, it will be replaced by a dummy wich is in the sheet categorie
    Attached Files Attached Files
    Last edited by Alex Piotto; 03-11-2018 at 01:27 PM.

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Get image shape from a sheet to image control in another sheet

    If you rename every ImageControl the same as your recipyname then you can use something like this.
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    07-15-2016
    Location
    Maputo, Mozambique
    MS-Off Ver
    2007
    Posts
    108

    Re: Get image shape from a sheet to image control in another sheet

    Good morning bakerman2, I was unable to put your tip to work... but I maybe found a partial workaround. Please tell me what you think....

    With this little sub I put the name of every picture in RICETTEDATABASE on the next cell to the right. Now I have the name of all pictures in the right place.

    Please Login or Register  to view this content.
    Now it is possible to tell to the sub below what is the name of the picture relative to the row selected. I am using a msgbox to try to understand...

    Please Login or Register  to view this content.

    BUT, I've got two issues with it.
    First of all, as the selezionaricetta combobox changes, the messagebox pop out empty, but after I click ok, it pop up again with the right picture number.

    It happen because the change() event happen 2 times, the first before the combobox is populated, the second after.
    I don't know how to avoid it...

    Second, the line of code commented give me an error.... Object doesn't support etc...

    So.... still stuck but with new ideas and trying to evolve.... could you help again please?

    I feel I am getting closer to the solution....

  9. #9
    Forum Contributor
    Join Date
    04-22-2016
    Location
    Philippines
    MS-Off Ver
    2016 & Office365
    Posts
    139

    Re: Get image shape from a sheet to image control in another sheet

    Try this if it is work...
    Please Login or Register  to view this content.

  10. #10
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Get image shape from a sheet to image control in another sheet

    Been playing around with your file. Take a look and let me know.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    07-15-2016
    Location
    Maputo, Mozambique
    MS-Off Ver
    2007
    Posts
    108

    Re: Get image shape from a sheet to image control in another sheet

    Hi amberle and thanks for answering.

    Before I try your code let me understand... why use vbNullString?

    Because the row may not contain a picture?

    The way I insert the photos is like: if the User do not load any photo a placeholder will be inserted instead.

    In this case is impossible not to find a picture. Every recipe will have a photo, either a real one or the dummy. It is no good for the file size but I'll fix it later.

    The second part with the OLEObject (the same happen with bakerman2 code) give me the error: Unable to get the OLEObjects property of the Worksheet Class.

  12. #12
    Forum Contributor
    Join Date
    07-15-2016
    Location
    Maputo, Mozambique
    MS-Off Ver
    2007
    Posts
    108

    Re: Get image shape from a sheet to image control in another sheet

    Wow thing are really different from my attempt... actually past the limit of my VBA knowledge.......

    As explained to amberle the line with OLEObject pops up the error.

    I can see my NameOfPhoto code in module1 but it seems you are not using it...

    Actually I think is a good way to go...
    I can see you too works around the name of the pictures in RICETTEDATABASE.
    So no matter the exact name of the picture, since I know it I can call it.

    In my case instead of the recipe name I will have Image1, Image2 etc but all in the right place.

    Why in my code I get an error: Object doesn't support this property or method?

    The string myphotoname is exactly Image1 or Image2 etc so why when is used in the line below with RICETTEDATABASE gives me the error?

    Please Login or Register  to view this content.
    It is like the string myphotoname is not replaced by the picture name... and it is not working, because the script is looking for a picture holder named myphotoname wich does not exist.... but in the message box the name exists. Need to find a way to replace the sting myphotoname with the value on column 7....
    Last edited by Alex Piotto; 03-12-2018 at 08:20 AM.

  13. #13
    Forum Contributor
    Join Date
    04-22-2016
    Location
    Philippines
    MS-Off Ver
    2016 & Office365
    Posts
    139

    Re: Get image shape from a sheet to image control in another sheet

    This one work for me...
    Try to add new recipe with photo...
    Attached Files Attached Files

  14. #14
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Get image shape from a sheet to image control in another sheet

    It will only work if you increase the row height.
    So each row has to be as high as each image.
    Can't attach a file with 2 images in it so PM me your emailaddress so I can send you the file that way.
    Last edited by bakerman2; 03-12-2018 at 11:45 AM.

  15. #15
    Forum Contributor
    Join Date
    07-15-2016
    Location
    Maputo, Mozambique
    MS-Off Ver
    2007
    Posts
    108

    Re: Get image shape from a sheet to image control in another sheet

    Eureka! Amberle, It really works! Now I am going to torture the code a little bit to check for weakness.... Thanks a lot man (if you are a man) or thaks a lot woman!
    Thanks anyway! The part with vbnullstring made the trick even if I do not yet understand how...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Add picture from userform image control to sheet cell as comment vba
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-01-2016, 10:57 AM
  2. [SOLVED] Using a Userform to Browse image file then paste selected image to sheet?
    By matrixpom in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-05-2015, 05:42 PM
  3. [SOLVED] VBA to transfer image FROM userform image control TO a worksheet cell
    By Zoediak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2014, 02:51 PM
  4. [SOLVED] Linking Image to a cell value, and display the selected image in new sheet
    By siva venkata in forum Excel General
    Replies: 12
    Last Post: 03-25-2014, 02:34 AM
  5. Insert image and image name into specific place on sheet
    By ACE23 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-05-2014, 04:41 AM
  6. [SOLVED] Use a button to control a macro that inserts an image into a shape or resets the shape
    By nwb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2013, 04:41 PM
  7. Displaying and Updating Image Dynamically (ActiveX Image Control?)
    By VTHokie11 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2011, 10:57 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1