Excel VBATutorial          

             

Excel VBA Macros

Email to excel-vba.com

Excel Tutorial on Macros

 Excel Consulting

Here is a sample of what you will find
in the downloadable 
Tutorial on Excel macros

Excel Image Controls

Image Control

There is a control in the toolbox called "Image" . Within this control you can show all types of pictures. You set an image control on  a userform and you submit a picture in the property "Picture" . The picture becomes part of the control and userform.

Fitting the Picture

The first thing that you want to do is to fit the picture in the image control to make the size of the control adapt to the size of the picture.

When you are in the Visual Basic Editor and you single click on an image control a frame appears around it with 8 stretchers (picture below). If you double click on the middle stretcher  (when a two tips arrow shows) of the right side or on the middle one at the  bottom or on the bottom right corner stretcher  the image control will adapt to the size of the image. Double clicking anywhere else will take you to the VBA code and will not adapt the control size to the picture size.

VBA-image control

PictureSizeMode Property

Another property of the image control is the PictureSizeMode.

If the property is set to the default value 0-frmPictureSizeModeClip the control size can be changed without the picture size being modified. So you can see only part of the picture or there can be a background behind it in a clolor color you can change at will.

If the property is set to the 1-frmPictureSizeModeStretch the picture is resized as the control is. The image fills the control.

If the property is set to the 3-frmPictureSizeModeZoom the picture is resized as the control is but the picture and background are present.


We hope you have enjoyed this introduction to lesson 33
for more on this topic and a complete course on Excel macros download the
Tutorial on Excel Macros


Back to Table of Contents