Microsoft Office Tutorials and References
In Depth Information
Making a UserForm Semitransparent
Saving a chart as a GIF file
The following code demonstrates how to create a GIF file (named temp.gif ) from a chart (in
this case, the first chart object on the sheet named Data ):
Set CurrentChart = Sheets(“Data”).ChartObjects(1).Chart
Fname = ThisWorkbook.Path & “\temp.gif”
CurrentChart.Export FileName:=Fname, FilterName:=”GIF”
Changing the Image control Picture property
If the Image control on the UserForm is named Image1 , the following statement loads the
image (represented by the Fname variable) into the Image control:
Image1.Picture = LoadPicture(Fname)
This technique works fine, but you may notice a slight delay when the chart is saved
and then retrieved. On a fast system, however, this delay is not noticeable.
Making a UserForm Semitransparent
Normally, a UserForm is opaque — it completely hides whatever is underneath it. However, you
can make a UserForm semitransparent, such that the user can see the worksheet under the
UserForm.
Creating a semitransparent UserForm requires a number of Windows API functions. You can set
the transparency level using values that range from 0 (UserForm is invisible) to 255 (UserForm is
completely opaque, as usual). Values in between 0 and 255 specify a level of semitransparency.
Figure 15-26 shows an example of a UserForm with a transparency level of 128.
This workbook is available on the companion CD-ROM. The filename is
semi-transparent userform.xlsm .
What good is a semitransparent UserForm? After giving this question some thought, I came up
with a potential use for this technique: creating a light-box effect. You’ve probably seen Web
sites that use the light-box effect. The Web page is dimmed (as if the lights are lowered), and an
image or pop-up is displayed. This effect serves to focus the user’s attention to a specific item on
the screen.
 
Search JabSto ::




Custom Search