Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 19th, 2011, 07:34 PM
Registered User
Join Date: Nov 2010
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Embedding Pictures in Excel

Is it possible to embed picutres in Excel? I'm not sure where to start.

I want to embed a single picture than can be used on multiple worksheets, but also make the picture appear or disappear on given worksheet based on a condition in an IF statement.

Any help would be greatly appreciated.


Old January 26th, 2011, 12:17 PM
JP JP is offline
Authorized User
Join Date: Apr 2008
Posts: 57
Thanks: 1
Thanked 3 Times in 3 Posts

What I would do is insert an Image control on the worksheet, and set the Picture Property to the image I want to show or hide.

Then I would use the Worksheet_Calculate Event to check the value of your formula and hide or show the control accordingly.

For example, if I had a formula in A1 and wanted to hide the image when the result of the formula equals 1, I would use this code:

Private Sub Worksheet_Calculate()
  Me.Image1.Visible = (Range("A1").Value = 1)
End Sub
I didn't rename the image control so the default name of Image1 applies.

You'll need to insert the image in every worksheet, however, and duplicate the code in each sheet module.
JP SoftTech

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pictures in Automation of Excel gardengirl447 BOOK: Access 2003 VBA Programmer's Reference 2 July 4th, 2011 06:54 PM
Save Pictures outside Excel jud_ltd Excel VBA 1 May 7th, 2006 08:26 AM
Embedding Excel Spreadsheet in C# Hitesh_Golyan C# 1 December 2nd, 2004 09:59 AM
Embedding an Excel spreadsheet in a VB application James Diamond Pro VB.NET 2002/2003 3 April 21st, 2004 11:18 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.