Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove Close Icon ?
Hi All
I'd like to remove the close icon on the titel bar and control the close myself. I can close everything OK but cannot find a way to remove the X from the title bar. I am including a button that pops up with an 'You are about to close this application Are You Sure ?' I can do everything except remove the X Any ideas please ? Malcolm |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove Close Icon ?
Alas, you can't remove the 'x'....om my wish list too..
Patrick Molloy Microsoft Excel MVP -----Original Message----- Hi All I'd like to remove the close icon on the titel bar and control the close myself. I can close everything OK but cannot find a way to remove the X from the title bar. I am including a button that pops up with an 'You are about to close this application Are You Sure ?' I can do everything except remove the X Any ideas please ? Malcolm . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove Close Icon ?
Thanks - wrong answer !!!
Is there a way to trap it without closing the window ? UserForm_Terminate is too late ! -----Original Message----- Alas, you can't remove the 'x'....om my wish list too.. Patrick Molloy Microsoft Excel MVP -----Original Message----- Hi All I'd like to remove the close icon on the titel bar and control the close myself. I can close everything OK but cannot find a way to remove the X from the title bar. I am including a button that pops up with an 'You are about to close this application Are You Sure ?' I can do everything except remove the X Any ideas please ? Malcolm . . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove Close Icon ?
You could of course remove the caption bar completely. Three parts to it,
the windows declarations, the procedure to hide the bar and finally calling it from the from initalize event section. Cheers N Using the following code. FIRST: Put the following in the form declarations section 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 DrawMenuBar Lib "user32" ( _ ByVal hWnd As Long) As Long SECOND: Put the following procedure in the form Private Function HideCaptionBar() Dim lngHnd As Long Dim lngStyle As Long Dim lngH(1) As Long Const GWL_STYLE = (-16) Const WS_CAPTION = &HC00000 lngH(0) = Me.Height - Me.InsideHeight If Val(Application.Version) 8 Then lngHnd = FindWindow("ThunderDFrame", Me.Caption) Else lngHnd = FindWindow("ThunderXFrame", Me.Caption) End If lngStyle = GetWindowLong(lngHnd, GWL_STYLE) And Not WS_CAPTION SetWindowLong lngHnd, GWL_STYLE, lngStyle DrawMenuBar lngHnd lngH(1) = Me.Height - Me.InsideHeight Me.Height = Me.Height + lngH(1) - lngH(0) End Function THIRD: In the form initialize section put the additional call instruction Private Sub UserForm_Initialize() Call HideCaptionBar End Sub "Patrick Molloy" wrote in message ... Alas, you can't remove the 'x'....om my wish list too.. Patrick Molloy Microsoft Excel MVP -----Original Message----- Hi All I'd like to remove the close icon on the titel bar and control the close myself. I can close everything OK but cannot find a way to remove the X from the title bar. I am including a button that pops up with an 'You are about to close this application Are You Sure ?' I can do everything except remove the X Any ideas please ? Malcolm . ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =--- |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove Close Icon ?
Malcolm -
You can use UserForm_QueryClose to see how the form was told to close: Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) '' Prevents use of the Close button If CloseMode = vbFormControlMenu Then MsgBox "Clicking the Close button does not work.", vbInformation Cancel = True End If End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Malcolm wrote: Hi All I'd like to remove the close icon on the titel bar and control the close myself. I can close everything OK but cannot find a way to remove the X from the title bar. I am including a button that pops up with an 'You are about to close this application Are You Sure ?' I can do everything except remove the X Any ideas please ? Malcolm |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove Close Icon ?
thx Jon,
I ended up finding it the hard way but you are dead right - it does exactly what I want and I can now prohibit the close from the close button ! -----Original Message----- Malcolm - You can use UserForm_QueryClose to see how the form was told to close: Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) '' Prevents use of the Close button If CloseMode = vbFormControlMenu Then MsgBox "Clicking the Close button does not work.", vbInformation Cancel = True End If End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Malcolm wrote: Hi All I'd like to remove the close icon on the titel bar and control the close myself. I can close everything OK but cannot find a way to remove the X from the title bar. I am including a button that pops up with an 'You are about to close this application Are You Sure ?' I can do everything except remove the X Any ideas please ? Malcolm . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
remove Format painter icon on speardsheet | Excel Discussion (Misc queries) | |||
how do I remove the % sign in cells without using the % icon | Excel Discussion (Misc queries) | |||
When I close Excel the icon moves | Excel Discussion (Misc queries) | |||
close icon has changed to a black box | Excel Discussion (Misc queries) | |||
Add a close icon to Excel's Toolbar | Excel Discussion (Misc queries) |