Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Disabling the "X" (Close) on a UserForm

Is there a way in which to disable the X on a UserForm so
that User can not close out the form? I need to be able
to do this for a spreadsheet that is used in both XL97
and XL02.

Any help would be appreciated.

Thanks.

Kirk
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Disabling the "X" (Close) on a UserForm

Thanks a lot. That worked PERFECT.

Kirk

-----Original Message-----
Kirk,

Use the form's QueryClose event. This has 2 arguments,

Cancel and CloseMode.
CloseMode tells you where the close originates from.

vbFormControlMenu 0 The user has chosen the Close

command from the
Control menu on the UserForm.
vbFormCode 1 The Unload statement is invoked from

code.
vbAppWindows 2 The current Windows operating

environment session is
ending.
vbAppTaskManager 3 The Windows Task Manager is

closing the
application.


You can test this, and if it's from an unload statement,

close else cancel

Private Sub CommandButton1_Click()
Unload Me
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer,

CloseMode As Integer)
Cancel = CloseMode < vbFormCode And CloseMode <

vbAppWindows
End Sub

--

HTH

Bob Phillips

"Kirk" wrote in message
...
Is there a way in which to disable the X on a UserForm

so
that User can not close out the form? I need to be

able
to do this for a spreadsheet that is used in both XL97
and XL02.

Any help would be appreciated.

Thanks.

Kirk



.

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
Disabling the "&[Time]" or "&[T]" in Excel headers and footers John Mirabella Excel Discussion (Misc queries) 2 January 15th 10 02:54 PM
disabling default "text to columns" while *.csv file opening vladdraco Setting up and Configuration of Excel 1 November 26th 08 02:00 PM
Disabling "wrap text" neuters alt-return line feeds within cell [email protected] Excel Discussion (Misc queries) 2 August 21st 06 04:49 PM
Disabling "SAVE AS" option under "File" Bidyut Bhattacharjee Excel Discussion (Misc queries) 3 March 22nd 06 06:35 PM
How can I get "File Close" to prompt me to "Save Changes" ?? Charles Jordan Excel Programming 4 July 31st 03 04:01 PM


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