LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Fading Form

Hi Jim,

Thank you for the correction.

I thought that the xlDynamic site had a downloadable example of a fading
form, but I can no longer find it

In any event, the link I gave relates to a timed splash screen without the
rquired fade.

Thank you also for your code.

---
Regards,
Norman



"Jim Rech" wrote in message
...
I don't think think Norman's link shows actual fading. Here's how you do
it:

In the userform's module:

Private Sub UserForm_Initialize()
hWndDirects = 0
End Sub

Private Sub CommandButton1_Click()
Dim Counter As Integer
Dim Counter2 As Long
For Counter = 255 To 1 Step -1
SetUFOpacity Me, CByte(Counter)
For Counter2 = 1 To 500 ''Delay loop
DoEvents
Next
Next
Unload Me
End Sub


And in a regular module:


Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Declare Function SetLayeredWindowAttributes Lib "user32" _
(ByVal hWnd As Long, ByVal crey As Byte, _
ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Const LWA_ALPHA = &H2&

Public hWndDirects As Long

Sub SetUFOpacity(Frm As UserForm, Alpha As Byte)
With Frm
If hWndDirects = 0 Then
hWndDirects = FindWindow("ThunderDFrame", .Caption)
SetWindowLong hWndDirects, GWL_EXSTYLE, _
GetWindowLong(hWndDirects, GWL_EXSTYLE) Or WS_EX_LAYERED
End If
SetLayeredWindowAttributes hWndDirects, 0, Alpha, LWA_ALPHA
End With
End Sub


--
Jim





 
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing a color document - color is fading CraigS Excel Discussion (Misc queries) 2 March 8th 10 08:44 PM
Blinking/Fading Message Box. FARAZ QURESHI Excel Discussion (Misc queries) 1 November 22nd 07 04:34 PM
How do I have data bars WITHOUT the clour fading to the right? MentalDan Excel Discussion (Misc queries) 3 April 7th 07 11:34 PM
Strange issue freezing parent form when unloading a child form Stefano Gatto Excel Programming 1 November 11th 05 04:42 PM
Is it possible to open the VBA form with a link in a sheet and to pass variable from a cell to the VBA form? Daniel[_14_] Excel Programming 1 August 29th 04 01:20 PM


All times are GMT +1. The time now is 11:22 AM.

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

About Us

"It's about Microsoft Excel"