![]() |
|
#1
|
|||
|
|||
|
Is it possible to create Userforms without the caption and close buttons?
Last edited by Adrian_Juman; 08-04-2011 at 22:48. |
|
#2
|
||||
|
||||
|
Hi.
Only with Api calls. Place the code in a form. Make sure to change form name in code if needed. Also don't forget to put a close form command button or you can't close it. Code:
Option Explicit
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 Const GWL_STYLE As Long = (-16) 'The offset of a window's style
Private Const WS_CAPTION As Long = &HC00000 'Style to add a titlebar
Private Declare Function DrawMenuBar Lib "user32" ( _
ByVal hwnd As Long) As Long
Private Sub UserForm_Initialize()
Dim hwndform&, istyle&, x#
hwndform = FindWindow("ThunderDframe", UserForm1.Caption)
istyle = GetWindowLong(hwndform, GWL_STYLE)
istyle = istyle And Not WS_CAPTION
x = SetWindowLong(hwndform, GWL_STYLE, istyle)
DrawMenuBar hwndform
End Sub
|
|
#3
|
|||
|
|||
|
Thanks John,
Works perfectly. I tried one I found on an Excel Forum but it didn't work. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Preview window - similary to sync window macro for Dar... | gorgo | Feature requests/wishlist | 4 | 12-05-2010 09:14 |
| Userform | norbert_ds | CorelDRAW/Corel DESIGNER VBA | 8 | 14-01-2008 11:39 |
| Automatically Populating a userform | norbert_ds | CorelDRAW/Corel DESIGNER VBA | 11 | 15-06-2007 17:41 |
| help: VBA minimize userform = frozen appwindow | wOxxOm | CorelDRAW/Corel DESIGNER VBA | 1 | 30-04-2006 05:13 |
| Possible for this Print Window?? | dungbtl | CorelDRAW/Corel DESIGNER VBA | 2 | 26-04-2004 15:01 |