Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm collapse ?
Hi Just wondering If anyone knows a way to add the icon "_" to collapse a
userform along with "X"(close form icon) that usually comes up on the form Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm collapse ?
Try (not fully tested):
Option Explicit Private Declare Function FindWindowA Lib "user32" _ (ByVal lpClassName As String, ByVal lpWindowName _ As String) 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 GetWindowLong Lib "user32" _ Alias "GetWindowLongA" (ByVal hWnd As Long, _ ByVal nindex As Long) As Long Private Const WS_MINIMIZEBOX = &H20000 Private Const GWL_STYLE = (-16) Private Sub UserForm_Initialize() SetWindowStyle FindWindowA(vbNullString, Me.Caption), _ WS_MINIMIZEBOX, True End Sub Private Sub SetWindowStyle(hWnd As Long, _ mAttribute As Long, Enable As Boolean) Dim x As Long x = GetWindowLong(hWnd, GWL_STYLE) If Enable Then x = x Or mAttribute Else x = x And Not mAttribute End If SetWindowLong hWnd, GWL_STYLE, x End Sub All the code should go into the UserForm module. -- Vasant "vbastarter" wrote in message ... Hi Just wondering If anyone knows a way to add the icon "_" to collapse a userform along with "X"(close form icon) that usually comes up on the form Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm collapse ?
Thank you it works.
"Vasant Nanavati" wrote: Try (not fully tested): Option Explicit Private Declare Function FindWindowA Lib "user32" _ (ByVal lpClassName As String, ByVal lpWindowName _ As String) 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 GetWindowLong Lib "user32" _ Alias "GetWindowLongA" (ByVal hWnd As Long, _ ByVal nindex As Long) As Long Private Const WS_MINIMIZEBOX = &H20000 Private Const GWL_STYLE = (-16) Private Sub UserForm_Initialize() SetWindowStyle FindWindowA(vbNullString, Me.Caption), _ WS_MINIMIZEBOX, True End Sub Private Sub SetWindowStyle(hWnd As Long, _ mAttribute As Long, Enable As Boolean) Dim x As Long x = GetWindowLong(hWnd, GWL_STYLE) If Enable Then x = x Or mAttribute Else x = x And Not mAttribute End If SetWindowLong hWnd, GWL_STYLE, x End Sub All the code should go into the UserForm module. -- Vasant "vbastarter" wrote in message ... Hi Just wondering If anyone knows a way to add the icon "_" to collapse a userform along with "X"(close form icon) that usually comes up on the form Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
collapse rows into one | Excel Discussion (Misc queries) | |||
Row Collapse control | Excel Discussion (Misc queries) | |||
Collapse Rows? | Excel Discussion (Misc queries) | |||
Subtotals Don't Collapse Correctly | Excel Discussion (Misc queries) | |||
Help Screens collapse | Setting up and Configuration of Excel |