Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default 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   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default 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   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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
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
remove Format painter icon on speardsheet Richard Excel Discussion (Misc queries) 2 August 19th 09 07:09 PM
how do I remove the % sign in cells without using the % icon Sydney sidekick Excel Discussion (Misc queries) 3 October 5th 06 07:12 PM
When I close Excel the icon moves Chevin Excel Discussion (Misc queries) 0 February 24th 06 01:50 PM
close icon has changed to a black box Wilko Excel Discussion (Misc queries) 0 September 26th 05 07:26 AM
Add a close icon to Excel's Toolbar SNiness Excel Discussion (Misc queries) 1 December 10th 04 06:18 PM


All times are GMT +1. The time now is 09:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"