Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Shu Shu is offline
external usenet poster
 
Posts: 5
Default Border style of Excel forms

Hello,
Why the form in Excel can not be set with some maximize or
minimize icon on the top ritht of form. Only two options
are provided in Excel VBE. One is 0-frmborderStylenone,
the other is 1-frmborderstylesingle. But There are more
choices in VB.

Is there any way to set up them?

Thanks very much.

Rgds
Shu
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Border style of Excel forms

Hi Shu;
Private Declare Function FindWindow& Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function SetWindowLong& Lib "user32" Alias _
"SetWindowLongA" (ByVal hWnd&, ByVal nIndex&, ByVal dwNewLong&)
Private Declare Function EnableWindow& Lib "user32" (ByVal hWnd&, ByVal fEnable&)
Private Declare Function ShowWindow& Lib "user32" (ByVal hWnd&, ByVal nCmdShow&)

' Minimize in application
Private Sub UserForm_Initialize()
Dim Style As Long
' Min: &H20000 / Max: &H10000 / Resize: &H40000
Style = &H84C80080 Or &H20000 Or &H40000
SetWindowLong FindWindow(vbNullString, Me.Caption), -16, Style
EnableWindow FindWindow(vbNullString, Application.Caption), 1
End Sub

To reduce the userform in the Taskbar, add the procedu
' Minimize in TaskBar
Private Sub UserForm_Activate()
Dim hWnd As Long
hWnd = FindWindow(vbNullString, Me.Caption)
ShowWindow hWnd, 0
SetWindowLong hWnd, -20, &H40101
ShowWindow hWnd, 1
End Sub

Regards
MP

"Shu" a écrit dans le message de
...
Hello,
Why the form in Excel can not be set with some maximize or
minimize icon on the top ritht of form. Only two options
are provided in Excel VBE. One is 0-frmborderStylenone,
the other is 1-frmborderstylesingle. But There are more
choices in VB.

Is there any way to set up them?

Thanks very much.

Rgds
Shu



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Border style of Excel forms

Hi Shu;
In complement of my post, you can use the following procedure to display the
userform in no modal mode:

Sub NoModalMode()
#If VBA6 Then
UserForm1.Show 0
#Else
UserForm1.Show
#End If
End Sub

MP

"Shu" a écrit dans le message de
...
Hello,
Why the form in Excel can not be set with some maximize or
minimize icon on the top ritht of form. Only two options
are provided in Excel VBE. One is 0-frmborderStylenone,
the other is 1-frmborderstylesingle. But There are more
choices in VB.

Is there any way to set up them?

Thanks very much.

Rgds
Shu



  #4   Report Post  
Posted to microsoft.public.excel.programming
Shu Shu is offline
external usenet poster
 
Posts: 5
Default Border style of Excel forms

Thanks a lot, Michel.

Shu
-----Original Message-----
Hi Shu;
Private Declare Function FindWindow& Lib "user32"

Alias "FindWindowA" _
(ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function SetWindowLong& Lib "user32"

Alias _
"SetWindowLongA" (ByVal hWnd&, ByVal nIndex&, ByVal

dwNewLong&)
Private Declare Function EnableWindow& Lib "user32"

(ByVal hWnd&, ByVal fEnable&)
Private Declare Function ShowWindow& Lib "user32" (ByVal

hWnd&, ByVal nCmdShow&)

' Minimize in application
Private Sub UserForm_Initialize()
Dim Style As Long
' Min: &H20000 / Max: &H10000 / Resize: &H40000
Style = &H84C80080 Or &H20000 Or &H40000
SetWindowLong FindWindow(vbNullString, Me.Caption), -

16, Style
EnableWindow FindWindow(vbNullString,

Application.Caption), 1
End Sub

To reduce the userform in the Taskbar, add the procedu
' Minimize in TaskBar
Private Sub UserForm_Activate()
Dim hWnd As Long
hWnd = FindWindow(vbNullString, Me.Caption)
ShowWindow hWnd, 0
SetWindowLong hWnd, -20, &H40101
ShowWindow hWnd, 1
End Sub

Regards
MP

"Shu" a écrit dans

le message de
...
Hello,
Why the form in Excel can not be set with some maximize

or
minimize icon on the top ritht of form. Only two options
are provided in Excel VBE. One is 0-frmborderStylenone,
the other is 1-frmborderstylesingle. But There are more
choices in VB.

Is there any way to set up them?

Thanks very much.

Rgds
Shu



.

Reply
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
border colors and style ralf Excel Discussion (Misc queries) 7 January 17th 10 04:36 PM
Change border style using VB Dbl_Planker Excel Discussion (Misc queries) 0 September 24th 09 10:18 PM
Create new border style? alexmoss Excel Discussion (Misc queries) 6 February 9th 09 03:18 AM
Creating a Default Border Style notmaria619 Excel Discussion (Misc queries) 0 September 25th 06 04:06 AM
Excel 2003 List does not preserve border style for all rows Geetha Excel Discussion (Misc queries) 0 August 16th 06 07:22 PM


All times are GMT +1. The time now is 07:17 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"