#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default various

I would like to end a job with some humor. Is it possible to randomly show
pictures or userforms when closing an userform?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default various

Mauro, try something like this:

Private Sub UserForm_initialize()
Dim myMax%, myMin%, myImageNumber%
Dim myImage$
myMax = 5
myMin = 1
myImageNumber = Round(Rnd * (myMax - myMin) * myMin + 1)
myImage = "D:\macros\Images\" & _
Round(Rnd * (myMax - myMin) * myMin + 1) & ".gif"
MsgBox myImage
Image1.Picture = LoadPicture(myImage)
End Sub

Regards, Lonnie M.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default various

Mauro, Try this:

Private Sub UserForm_initialize()
Dim myMax%, myMin%, myImageNumber%
Dim myImage$
myMax = 5
myMin = 1
myImageNumber = Round(Rnd * (myMax - myMin) * myMin + 1)
'Be sure to change the directory to where your images are
myImage = "D:\macros\Images\" & myImageNumber & ".gif"
MsgBox myImage
Image1.Picture = LoadPicture(myImage)
End Sub

Regards, Lonnie M.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default various

Mauro, Try this:


Private Sub UserForm_initialize()
Dim myMax%, myMin%, myImageNumber%
Dim myImage$
'Use whatever min or max values you want
myMax = 5
myMin = 1
myImageNumber = Round(Rnd * (myMax - myMin) * myMin + 1)
'Be sure to change the directory to where your images are


myImage = "D:\macros\Images\" & myImageNumber & ".gif"
Image1.Picture = LoadPicture(myImage)
End Sub

Regards, Lonnie M.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"