LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Splash screens from VBA!

I'm really excited beacuse I've just learned how to remove the title bar from
a form in vba - thought I'd better share. You need to use windows API calls
so I suppose it's not strictly vba but very exciting nevertheless. It's going
to be splash screens a-go-go for my addin's from now on.

Simply add the following code to a new form in excel.

__________________________________________________ ______________

Private Const GWL_STYLE = (-16)
Private Const WS_CAPTION = &HC00000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_SYSMENU = &H80000


Private Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long

Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex _
As Long) As Long

Private Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex _
As Long, ByVal dwNewLong As Long) As Long

Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Integer, ByVal lParam As Long) As Long

Private Declare Function DrawMenuBar Lib "user32" (ByVal _
hwnd As Long) As Long

Private wHandle As Long

Private Sub UserForm_Initialize()
Dim lStyle As Long

If Val(Application.Version) = 9 Then
wHandle = FindWindow("ThunderDFrame", Me.Caption)
Else
wHandle = FindWindow("ThunderXFrame", Me.Caption)
End If
If wHandle = 0 Then Exit Sub

lStyle = GetWindowLong(wHandle, GWL_STYLE)
Me.Caption = ""
lStyle = lStyle And Not WS_SYSMENU
lStyle = lStyle And Not WS_MAXIMIZEBOX
lStyle = lStyle And Not WS_MINIMIZEBOX
lStyle = lStyle And Not WS_CAPTION

SetWindowLong wHandle, -20, frm
SetWindowLong wHandle, GWL_STYLE, lStyle
DrawMenuBar wHandle
End Sub

__________________________________________________ ________________


- Rm
 
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
Two Screens??? Wayne Excel Discussion (Misc queries) 1 December 23rd 04 07:48 PM
Splash Jena Excel Programming 1 July 26th 04 07:51 PM
Splash Tim Excel Programming 4 July 8th 04 03:22 PM
splash Jessie[_4_] Excel Programming 1 February 13th 04 12:57 AM
Pop Up Screens Darren O'Connell Excel Programming 3 July 18th 03 02:51 PM


All times are GMT +1. The time now is 04:53 PM.

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"