Search TeachExcel.com
TeachExcel.com
TE
Teach Excel MS Office Tutorials Excel Consulting Services Excel Forum
Excel Video Tutorials Excel Tips Free Excel Macros Excel Help Resources Contact TeachExcel
Video Tutorials
  • Free Macros
  • Excel Help Directory
  • Excel 2007 Resources
  • Keyboard Shortcuts
  • Excel Forum
  • Contact/About

Macros
Excel Tutorials For Macros

Add Background Photos / Images to Comments in Excel


Bookmark and Share

Add background images and photos to your comments in Excel with this macro. This macro uses a really cool feature in Excel that allows you to set a photo or image from your computer as the background image for a comment. This allows you to spruce up your comments to make them less boring or simply in line with the them of your workbook or worksheet.

This macro will add a comment and then add the background image to that comment. However, you can just delete this line Range("A1").AddComment ("Comment text goes here.") if you want to use this macro to set a background image to an existing comment in your Excel spreadsheet.

To use this macro, replace the range references A1 with the reference of the cell where you would like to add a comment or just put a background photo in a comment. The range reference for both lines in the macro must be exactly the same. Also, replace this text C:\image.jpg with the file path location of the image on your computer which you want to set as the background fro the comment. You need to include all of the folders in the file path and the photo extension for the image for the macro to work correctly in Excel.
Where to install the macro:  Module

Excel Macro to Add Background Photos to Comments in Excel

Sub Insert_Comment_Add_Background_Picture()
'Macro to insert a comment in cell A1 and then set a picture or photo as the background for that comment

Range("A1").AddComment ("Comment text goes here.")

Range("A1").Comment.Shape.Fill.UserPicture "C:\image.jpg"

End Sub


Bookmark and Share


How to Install the Macro
  1. Select and copy the text from within the grey box above.

  2. Open the Microsoft Excel file in which you would like the Macro to function.

  3. Press "Alt + F11" - This will open the Visual Basic Editor - Works for all Excel Versions.  Or For other ways to get there, Click Here.

      For Excel Versions Prior to Excel 2007
      Go to Tools > Macros > Visual Basic Editor

      For Excel 2007
      Go to Office Button > Excel Options > Popular > Click Show Developer tab in the Ribbon. Then go to the Developer tab on the ribbon menu and on the far left Click Visual Basic

  4. On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.

  5. If the Macro goes in a Module, Click Here, otherwise continue to Step 8.

    1. Go to the menu at the top of the window and click Insert > Module
    2. Another window should have opened within the Visual Basic Editor's window. Within this new window, paste the macro code. Make sure to paste the code underneath the last line of anything else that is in the window.
    3. Go to Step 8.

  6. If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.

    1. Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
    2. Then, at the bottom of the list that appears, double-click the ThisWorkbook text.
    3. A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
    4. Go to Step 8.

  7. If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.

    1. Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
    2. Within the list that appears you will see every worksheet that is in that excel file. They will be listed as such: Sheet1(NAME OF SHEET HERE) and under that will be Sheet2(NAME OF SHEET HERE). Select the sheet in which you want the macro to run and double-click that sheet.
    3. A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
    4. Repeat steps b and c for every sheet you want the macro to work in. Putting the macro in one sheet will not enable it for any other sheets in the workbook.
    5. Go to Step 8.

  8. Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.

  9. You are now ready to run the macro.



Similar Helpful Excel Resources

Set Excel Background To Changing Images - Excel

View Content
I have an image that changes based on a selection from a validation list (i.e. if someone selects the dallas cowboys from a validation list, the dallas cowboys logo comes up in this image). Right now I have this image in the top right, but i would love to set it as a transparent background where you can still see all the data. I know how to add a background, but only from a saved file. How can i get the changing image to be my background? Thanks.

Extracting Photos From Comments! - Excel

View Content
Hi,

I have a unique problem and any help would be appreciated.

Initially, I saved some 2-300 photos in comments, one in each cell.

Now I have lost all those photos from my desktop and want to extract the pics embedded in comments to either a word document or to another workbook....and i just cant figure out how!

And I really don't want to kill myself by Print Screening, cropping in Paint and then pasting...just too much work!

Help...anyone??


Thanks,
Amit

Excel Should Allow Background Images To Stretch Fit The Screen - Excel

View Content
Im designing a rental system for a games company. At the main menu screen, I
have an image that I want to strecth fit the screen, not to tile it like it
was a wallpaper as some of my images cannot be cropped without loss of
quality. For high quality images, tiling reduces the speed of my system

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...lic.excel.misc


Repeating Background Images - Excel

View Content
I added a background to an Excel spreadsheet. Unfortunately it repeats the
image all the way to the bottom of the worksheet, making a 30K document about
3MB in size. How can I have it only display the image once immediately behind
my content without repeating? If I cannot limit that, is there a way to force
the worksheet to be only 100 rows long and 15 columns wide, eliminating the
repetitive images simply by reducing the "physical" size of the worksheet?
--
Steve Mullen


Background Images For Userforms - Excel

View Content
I've got a data entry userform in Excel VBA that someone is going to have to look at a lot. Any suggestions for a nice background image to make it a bit less boring? Not distracting, but not as boring as plain color?


Thanks,

Greg

Macro To Add Images In Comments - Excel

View Content
Okay, let's see if I can explain this easy...

I have a lot of cells that I want to show an image when hovered over them. Figured out how to do it in comment boxes but since there are so many I was hoping that it could be done with a macro.

The images are named the same as the text in the cells except everything is lowercase and underscores ( _ ) in stead of spaces. Oh, and it's in several worksheets but the worksheets are named the same as the folder the images are in.

I know it's rude to just register on a forum and ask a question right away without introducing myself first but I've been pulling my hair out (or what's left of it) over this thing. And I'm just too lazy to do everything manually

Background Images In Cells Combined With Text - Excel

View Content
Depending on criteria, derived from within a VBA module, I want to add one of a number of images to a cell as a background. To this cell I will then add a count, so for example if I added a picture of an orange and the number 5 to show 5 oranges, rather than the colour orange, in reality it will not be an orange it will be a jpg of a holiday snap and the quantity required.

Yes, I can put the count in an adjacent square to the image, just wondering if the two can be combined in one cell

Answers on a postcard to ....

Dragging Photos Into Excel - Excel

View Content
I would like to drag 100 photos into an excel sheet, is this possible with out inserting each one at a time? I should add that I was hoping there was a way to format these into each cell, so they all are the same size...

Photos In Excel And Email - Excel

View Content
Hi
I have a macro there send a email made in html
so far so good its working. I take the values from a sheet in excel
but in this sheet there are also a picture, and in a html code the pictures
are a link to a souce file, is there someway to take the picture from the
sheet and put it in the html code whitout have the photo as a source file?
If i make a email in outlook i can put a picture into the email so maybe also
when i create this email from excel ??

Hope someone knows somthing about this

Regards alvin



Embed Photos, Sounds Etc Within Excel - Excel

View Content
I am not sure whether "embedding" is the right word. Please have a look at this excel file and tell me how to make such a file?

http://rapidshare.com/files/10525374...rence.xls.html


(Also, is there no way--- I can attach/upload files in this forum while posting threads?)

Random Tutorials
Net Present Value / Discounted Cash Flow Calculations
(Intermediate)
FV() Find the Future Value of Cash Today
         -Savings/Retirement Plan Calculations

(Intermediate)
Remove #N/A Error Result from Empty VLOOKUP() Formulas
(Intermediate)
IF Statement Introduction & Using Nested IF's
(Easy)
HLOOKUP() Function - Introduction
(Intermediate)
Consolidate & Combine Data from Separate Worksheets or Workbooks(Excel Files)
(Intermediate)
Submit Inquiry Here
  • Prices From $10
Name:*
E-mail:*
Request:*
The macro(s) on this page will be sent with the request.
Contact | Privacy Policy | Disclaimer
Copyright© 2012 TeachExcel.com