Pasting a picture into a note

glad_ir

Board Regular
Joined
Nov 22, 2020
Messages
143
Office Version
  1. 2010
Platform
  1. Windows
Hello,

I've got a bit of a strange request. Hoping somebody can help with this one please.

I would like my sheet to create a note in a cell (e.g. F2) and paste a picture contained in another cell (e.g. B2) into the note when I trigger the macro.

The picture in cell F2 will be entered by users of the sheet and it's name will vary.

Is this possible? Any help would be much appreciated

Thank you,
Iain
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
This version selects image from FileDialog or it can be hardcoded from an image path.

VBA Code:
'SOURCE: www.TheSpreadsheetGuru.com/the-code-vault

Dim PicturePath As String
Dim CommentBox As Comment
Dim msoScaleFormTopLeft

'[OPTION 1] Explicitly Call Out The Image File Path
  'PicturePath = "C:\Users\chris\Desktop\Image1.png"

'[OPTION 2] Pick A File to Add via Dialog (PNG or JPG)
   With Application.FileDialog(msoFileDialogFilePicker)
    .AllowMultiSelect = True
    .Title = "Select Comment Image"
    .ButtonName = "Insert Image"
    .Filters.Clear
    .Filters.Add "Images", "*.png; *.jpg"
    .Show
    
    'Store Selected File Path
      On Error GoTo UserCancelled
        PicturePath = .SelectedItems(1)
      On Error GoTo 0
    End With

'Clear Any Existing Comment
  Application.ActiveCell.ClearComments

'Create a New Cell Comment
Set CommentBox = Application.ActiveCell.AddComment

'Remove Any Default Comment Text
  CommentBox.Text Text:=""

'Insert The Image and Resize
  CommentBox.Shape.Fill.UserPicture (PicturePath)
  CommentBox.Shape.ScaleHeight 6, msoFalse, msoScaleFormTopLeft
  CommentBox.Shape.ScaleWidth 4.8, msoFalse, msoScaleFromTopLeft

'Ensure Comment is Hidden (Swith to TRUE if you want visible)
  CommentBox.Visible = False

Exit Sub

'ERROR HANDLERS
UserCancelled:

End Sub
 
Upvote 0
Hi,

Thank you for responding. I'm pretty new to VBA and don't know how to modify this code to pick up the picture in cell B2. The code as is goes to file explorer.

Please could you say a bit more.

thnk you,
Iain
 
Upvote 0
I have researched for several hours without finding anything that will directly perform what you are seeking. I am not aware of a means to insert an image into a Cell Comment
by referencing another cell's address holding an image.

Perhaps if you better describe what you project goal is, in addition to what you have already stated, it would make it more understandable.
 
Upvote 0
I have researched for several hours without finding anything that will directly perform what you are seeking. I am not aware of a means to insert an image into a Cell Comment
by referencing another cell's address holding an image.

Perhaps if you better describe what you project goal is, in addition to what you have already stated, it would make it more understandable.
Hi,

Thank you for taking the time to look into this and for trying to help. It sounded a tough ask!

I have a sheet which is used to display formation and removal points for impurities in a chemical synthesis. The sheet prompts the user to enter the chemical structure of each impurity as a picture in specified cells (e.g. B2, B3, B4 etc). I would like the sheet to copy the pictures in column B and paste them into notes in new cell (e.g. F2, F3, F4 etc). The user will then add additional information to the column F calls and paste these cells at appropriate points in a grid.

Thank you for your help,
Iain
 
Upvote 0
Do I correctly understand when you state "notes" ... you are not referring to 'COMMENT' ?

In other words: right click any cell ... then select INSERT COMMENT ?
 
Upvote 0
Hi,

It's the "new note" rather than "new comment" when you right click on the cell.

thanks,
Iain
 
Upvote 0
Ok ... my understanding of the new NOTES ... it was simply a name change. It is still the old COMMENT. So ... to the best of my knowledge you won't be able to achieve your goal
using NOTES or the new COMMENTS.
 
Upvote 0
Solution
Ok ... my understanding of the new NOTES ... it was simply a name change. It is still the old COMMENT. So ... to the best of my knowledge you won't be able to achieve your goal
using NOTES or the new COMMENTS.
Thank you for your help with this and providing a clear outcome.

Much appreciated!

Best regards,
Iain
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,701
Members
448,980
Latest member
CarlosWin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top