+ Reply to Thread
Results 1 to 10 of 10

Excel Macro to Insert a Comment and add a Picture to the Comment

  1. #1
    Forum Contributor
    Join Date
    06-14-2016
    Location
    Brookland, Arkansas
    MS-Off Ver
    2007,2021
    Posts
    129

    Excel Macro to Insert a Comment and add a Picture to the Comment

    Hello so I am trying to do what the title says. But I have no experience with the VBA coding side of excel

    I've gotten as far as this,

    Please Login or Register  to view this content.
    This creates a totally blank comment. Past here I'm stuck. I have the process below for how to get to the option I want only using keys, but when I try to "record macro" it doesn't pick up those key strokes. Can anyone help me with how to get where I'm trying to go via a macro/VBA coding?

    1) Press Shift+F2 to insert a new comment
    2) press esc ONCE to exit text space but still have comment selected
    3) Press shift+F10 to open the right click menu
    4) press O to open the format comment menu
    5)press C to get to the colors and lines menu
    6) press tab once to get to the color selelection
    7) press enter to open the color selection
    8) press tab 5 times to get to the fill effects
    9) press enter to open the fill effects
    10)press control+tab 3 times to get to the picture menu
    11) press tab once to get to the select picture option
    12) press enter to open the select picture option
    Last edited by TheMechEngineer; 07-12-2019 at 12:05 PM.
    Who needs a life when you have Excel.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Excel Macro to Insert a Comment and add a Picture to the Comment

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)

  3. #3
    Forum Contributor
    Join Date
    06-14-2016
    Location
    Brookland, Arkansas
    MS-Off Ver
    2007,2021
    Posts
    129

    Re: Excel Macro to Insert a Comment and add a Picture to the Comment

    If the execution as a whole is too much to tackle. Would some be able to tell me the coding to simulate a keystroke. For example what is the code I write for excel to think I've pressed "Shift+F2" or "tab" any number of times.

  4. #4
    Forum Contributor
    Join Date
    06-14-2016
    Location
    Brookland, Arkansas
    MS-Off Ver
    2007,2021
    Posts
    129

    Re: Excel Macro to Insert a Comment and add a Picture to the Comment

    There you go, I hope that makes things more clear as to what I've coded so far.
    Last edited by Pepe Le Mokko; 07-12-2019 at 12:06 PM. Reason: Removed unnecessary quotes

  5. #5
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Excel Macro to Insert a Comment and add a Picture to the Comment

    Thanks, but the tags didn't appear. For some reason the closing tag was misspelled. Did you add them by hand?
    Anyway, I changed it for you. In the future just select the code and click # button

    (an also don't quote entire posts unnecessarily, they are clutter and make threads hard to read)
    Thanks

  6. #6
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Excel Macro to Insert a Comment and add a Picture to the Comment

    This being said, you might find lots of help at https://www.contextures.com/xlcomments03.html

  7. #7
    Forum Contributor
    Join Date
    06-14-2016
    Location
    Brookland, Arkansas
    MS-Off Ver
    2007,2021
    Posts
    129

    Re: Excel Macro to Insert a Comment and add a Picture to the Comment

    Thank you, for correcting it. I didn't add it by hand though, I copied it out off the forum post you linked me. Sorry, as I said before, this side of things is totally alien to me.
    Last edited by TheMechEngineer; 07-12-2019 at 12:24 PM.

  8. #8
    Forum Contributor
    Join Date
    06-14-2016
    Location
    Brookland, Arkansas
    MS-Off Ver
    2007,2021
    Posts
    129

    Re: Excel Macro to Insert a Comment and add a Picture to the Comment

    That was a good article Pepe. From going over it, the results it gives aren't quite what I am aiming for. However, upon further research I found the "SendKeys" command (https://social.technet.microsoft.com...ys-method.aspx) this seems to do what I am asking although when I try to create a dummy macro to test it out to make sure I understand it, the macro errors out. Here is my code
    Please Login or Register  to view this content.
    Last edited by TheMechEngineer; 07-12-2019 at 12:40 PM.

  9. #9
    Forum Contributor
    Join Date
    06-14-2016
    Location
    Brookland, Arkansas
    MS-Off Ver
    2007,2021
    Posts
    129

    Re: Excel Macro to Insert a Comment and add a Picture to the Comment

    Please Login or Register  to view this content.
    boom

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Excel Macro to Insert a Comment and add a Picture to the Comment

    Hello MechEnginner,

    Here is a macro that will add a comment and a picture to the active cell. You will need to change the "PicPath" to picture you want in the comment. This macro allows you to easily change the comment properties.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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] Help with a macro to insert a picture into a comment
    By mhewett in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-29-2012, 12:22 PM
  2. Insert specific picture into comment Macro help!
    By jarednz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-24-2011, 10:01 PM
  3. Macro: Insert Comment with Picture
    By Screamer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-24-2009, 12:45 PM
  4. [SOLVED] How do I insert a picture within an Excel comment box?
    By Roy White in forum Excel General
    Replies: 1
    Last Post: 09-23-2005, 09:05 AM
  5. EXCEL: Is there a way to insert a picture into a comment?
    By Max in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 09-06-2005, 07:05 PM
  6. EXCEL: Is there a way to insert a picture into a comment?
    By Max in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-06-2005, 09:05 AM
  7. [SOLVED] EXCEL: Is there a way to insert a picture into a comment?
    By m.l.v. in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  8. [SOLVED] EXCEL: Is there a way to insert a picture into a comment?
    By m.l.v. in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 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