Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
How can i make this code work in VBA for Excel to make a translucent form ?
it works fine in vb,
---------------
Option ExplicitPrivate Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2Private Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long) As LongPrivate Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) _
As LongPrivate Declare Function SetLayeredWindowAttributes Lib _
"user32" (ByVal hWnd As Long, ByVal crKey As Long, _
ByVal bAlpha As Byte, ByVal dwFlags As Long) As LongPublic Function TranslucentForm(frm As UserForm, TranslucenceLevel As Byte) As Boolean
SetWindowLong frm.hWnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes frm.hWnd, 0, TranslucenceLevel, LWA_ALPHA
TranslucentForm = Err.LastDllError = 0
End Function
Private Sub UserForm_show()
TranslucentForm Me, 180 ' 0 - 255
End SubPrivate Sub UserForm_click()
End Sub

Try looking up Alphabending. Also, many translucent
functions only work with Windows 2000 and
Windows XP.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |