Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Moh Moh is offline
external usenet poster
 
Posts: 58
Default Disable the Close button on a Userform

how do i disable the close button on my userform?
or can i just remove it?

and when the user clicks cancel... is there a way to direct the user back to
sheet1 ?

Cheers
--

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Disable the Close button on a Userform

Hi,

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
If CloseMode = vbFormControlMenu Then
' make user do what you want"
Cancel = True
End If
End Sub

HTH
  #3   Report Post  
Posted to microsoft.public.excel.programming
Moh Moh is offline
external usenet poster
 
Posts: 58
Default Disable the Close button on a Userform

where do i put this code?
--



"Carim" wrote:

Hi,

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
If CloseMode = vbFormControlMenu Then
' make user do what you want"
Cancel = True
End If
End Sub

HTH

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Disable the Close button on a Userform

On Dec 14, 2:32 pm, Moh wrote:
where do i put this code?
--



"Carim" wrote:
Hi,


Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
If CloseMode = vbFormControlMenu Then
' make user do what you want"
Cancel = True
End If
End Sub


HTH- Hide quoted text -


- Show quoted text -


Hi
Double click your form and paste it in (the code module behind the
form)
regards
Paul
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Disable the Close button on a Userform

Open your form, hit F7 and copy code ...


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Disable the Close button on a Userform

where do i put this code?

In the UserForm's code module.

Hth,
Merjet


  #7   Report Post  
Posted to microsoft.public.excel.programming
Moh Moh is offline
external usenet poster
 
Posts: 58
Default Disable the Close button on a Userform

it doesn't work

pls help further
--



" wrote:

On Dec 14, 2:32 pm, Moh wrote:
where do i put this code?
--



"Carim" wrote:
Hi,


Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
If CloseMode = vbFormControlMenu Then
' make user do what you want"
Cancel = True
End If
End Sub


HTH- Hide quoted text -


- Show quoted text -


Hi
Double click your form and paste it in (the code module behind the
form)
regards
Paul

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Disable the Close button on a Userform

What exactly do you mean by "it doesn't work"?

Maybe you need to add a Command Button with
the following code:

Private Sub CommandButton1_Click()
Sheet1.Activate
Unload Me
End Sub



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
Disable close button on all froms & MsgBoxes Haxer Excel Programming 2 August 9th 07 05:42 PM
Disable Close Button dan Excel Discussion (Misc queries) 5 September 22nd 06 07:39 PM
Disable the Close Window button of the worksheet yangyh[_7_] Excel Programming 0 September 14th 05 05:04 AM
How to disable a sheet's x(close) button? Stefi Excel Programming 4 May 6th 05 01:21 PM
Disable close button of Modeless Userform RB Smissaert Excel Programming 2 September 13th 03 09:46 PM


All times are GMT +1. The time now is 06:20 PM.

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"