+ Reply to Thread
Results 1 to 7 of 7

Add picture from userform image control to sheet cell as comment vba

  1. #1
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Add picture from userform image control to sheet cell as comment vba

    Hi all,
    I am having an issue with macro.
    I want to simply add image from userform image1 to sheet cell as comment.
    Following code work well for other aspects. Red highlighted line has an issue.
    If anyone can help please.
    Many thanks
    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Add picture from userform image control to sheet cell as comment vba

    You need the image path and file name for the .Comment image. I don't know a way to get that directly from the Image1 control. But when you load an image in the Image1 control, you can store the Path and Filename in the Image1.Tag property

    Please Login or Register  to view this content.
    Then later, use that .Tag property to retrieve the path and file name for the comment image.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Add picture from userform image control to sheet cell as comment vba

    Hi AlphaFrog,
    First of all thank you for your help.
    I have studied your solution , however everytime its a different image.
    Is it possible to get path as text to another textbox when picture is loaded and then use this textbox path ( Tag) later in your solution as tag??
    Any help please.
    K regs
    KK1234

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Add picture from userform image control to sheet cell as comment vba

    Quote Originally Posted by KK1234 View Post
    Hi AlphaFrog,
    First of all thank you for your help.
    I have studied your solution , however everytime its a different image.
    Is it possible to get path as text to another textbox when picture is loaded and then use this textbox path ( Tag) later in your solution as tag??
    Any help please.
    K regs
    KK1234
    When you say it's a different image every time, when you load an image in the Image1 control, simply store the path and file name in the .tag property. So whatever image is in the control, it's path and filename are also there in the .tag property. That's basically the same thing you're asking to do with a separate textbox.

    In the example above, I use a fixed image path and file name for the Image1 image. You can use whatever your using now to load the Image1 image. Just add that path and file name to the .Tag property as well.
    Last edited by AlphaFrog; 10-30-2016 at 11:10 AM.

  5. #5
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Add picture from userform image control to sheet cell as comment vba

    One can create a BMP file from a picture object without knowing the filename but I prefer AlphaFrog's Tag property method.

    I would suggest that you find some way to not use SendKeys().
    Last edited by Kenneth Hobson; 10-31-2016 at 10:37 AM.

  6. #6
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Add picture from userform image control to sheet cell as comment vba

    Hi Kenneth and AlphaFrog,
    I agree with both of you. After a trial & method , I finally adapted AlphaFrog's solution and it works well.
    I have changed code a bit avoiding SendKeys() method.
    Final version is that I have provided user an option to choose a picture file then, further options if user wants to attach it to email or place as comment or even insert it in email body or all three.
    It took a while but finally worked. Only thing I noticed is that if we have to insert a picture in comments, files become heavy, hence I have allowed only certain pictures such tech drawings etc.
    Thank you for your kind guidance.
    I now close this as solved.
    Thank you again.
    " Success is never ending and failure shall never be final"
    I got there at the end with your help
    Kind regards

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Add picture from userform image control to sheet cell as comment vba

    You're welcome and thinks for the feedback.

+ 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. Replies: 1
    Last Post: 10-19-2016, 11:15 PM
  2. Picture from comment to userform.Image
    By selector in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-11-2014, 04:19 AM
  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] show jpeg picture inside a userform image control box
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 07-29-2013, 03:44 PM
  5. How to access bitmap picture stored as property of image control on userform
    By Spere in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-17-2013, 05:41 PM
  6. Change picture in image control based on cell values.
    By Rberg365 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2010, 05:26 PM
  7. Extract Picture from Excel cell Comment, and add to VBA Control
    By PetersBase in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-07-2010, 12:06 PM

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