![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Location: iceland
Posts: 138
|
Hi all excel people.
Is it possible to greate a pop up window. I have a picture in .gif format (radiator.gif) I have greated a button (called "Picture") in my worksheet. Is it possible to assign a macro to it, so that everytime you push that putton,a window pops up showing that picture (radiator.gif). I´m not very good in vba, so if you could givge me the exact code, would be wonderful. stulli77@hotmail.com |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Apr 2002
Location: Kissimmee, Florida
Posts: 384
|
You can do this using a form...
In the VBE Project window insert a User form. (Right click the current file) select the userform in the main window. On the form tool box click the picture button and drag picture to the required size. In the properties window. Scroll to the "Name" box and click box name the form "Rad1". Scroll down to "Picture" box click in the box beside this and browse to your picture(Radiator.gif) Next go to a macro module (insert one if not there) insert Code as follows Sub ShowPic() Rad1.Show End Sub You can tailor your form to have ok buttons etc but the above will work just need to click X in corner to close. If you want to use this at a later stage in a macro with buttons the command to turn off the form on an event is Rad1.hide
__________________
Hope This Helps. Sean. Digest of Homes WinXP, XL XP |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Location: iceland
Posts: 138
|
Tank you s-o-s, the popup window works great!
I have also greated a "close window" button on my userform, how do i make it work? where do I write Rad1.hide, do i have to make another module, or do i write it in the same module where i wrote Sub ShowPic() Rad1.Show End Sub Tankx for your help |
|
|
|
|
|
#4 | |
|
Board Regular
Join Date: Apr 2002
Location: Kissimmee, Florida
Posts: 384
|
Quote:
I assume you've added a Command Button from the toolbox. Right click the edge of the box and select view code from the shortcut menu. This will give you the start and end of the procedure. Insert in between Sub and endsub... Rad1.hide That's it
__________________
Hope This Helps. Sean. Digest of Homes WinXP, XL XP |
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Apr 2002
Location: iceland
Posts: 138
|
´Great! this works perfectly! Thank you very much for your help! |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|