Article ID: 213732 - View products that this article applies to.
This article was previously published under Q213732
In Microsoft Excel 2000, you can add an image control to a user form. There are two ways to specify which picture file is displayed in the image control; you can specify the picture when you design the user form, or you can specify the picture when you run the user form. The technique you use depends on whether you want to store the picture file with your project.
The advantage of using the run-time method is that the picture file is not stored with the project, which minimizes the size of the project. However, if you distribute the project to others, you must remember to include the picture file with the project file, and you must provide instructions for placing the picture file in the correct location.
This article provides an example Visual Basic for Applications macro that uses the LoadPicture function to load a picture file into an image control during run time.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs.
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:
Microsoft Certified Partners - https://partner.microsoft.com/global/30000104
Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS
Creating the User Form and the Macro Code
Customizing the Macro for the Path to Your DesktopNOTE: The path to your Desktop folder may be different, depending on how you logged on to Windows. If you log on to Windows with a password, the Desktop location may be the Windows\Profiles\<username>\Desktop folder. Therefore, you must use a different path in the LoadPicture function and in the following OptionButton functions. To customize the macro for the path to your desktop:
Creating the Two Picture Files
Running the Macro
For more information about using an Image control, click Microsoft Visual Basic Help on the Help menu, type image control in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
Contact us for more help
Connect with Answer Desk for expert help.