Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Window's System Menu, can't remove menu

Not to find how to trap window closing i'm trying to disable "X"-button,
and System menu. With API.

API's "RemoveMenu" works with Forms but not with Worksheet Windows!!!
"X"-button can be disabled, but System Menu - can't!!

is it impossible to remove items of System Menu of a Worksheet Window????

Yury


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Window's System Menu, can't remove menu

I think people typically use Tools, Protection, Protect Workbook, Windows to
get to where you want to go.

--
Jim Rech
Excel MVP


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Window's System Menu, can't remove menu

Yuri,

If you make your userform full screen, *none* of the toolbars are
accessible.
Disable the "X" on your form and the only way a user can get out of the form
is to click your Exit button on the form.

Private Sub UserForm_Initialize()
With Application
Me.Top = .Top
Me.Left = .Left
Me.Height = .Height
Me.Width = .Width
End With
End Sub

HTH
Henry


"Yury Lobanov" wrote in message
...
Not to find how to trap window closing i'm trying to disable "X"-button,
and System menu. With API.

API's "RemoveMenu" works with Forms but not with Worksheet Windows!!!
"X"-button can be disabled, but System Menu - can't!!

is it impossible to remove items of System Menu of a Worksheet Window????

Yury




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 214
Default Window's System Menu, can't remove menu

Hi Yuri;
You can try (in the ThisWorkbook module):
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String _
, ByVal lpsz2 As String) 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 GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long

Private Sub Workbook_Open()
Application.WindowState = xlMaximized
With ActiveWindow
.WindowState = xlNormal
.Top = 0: .Left = 0
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Dim hWnd(1 To 3) As Long
hWnd(1) = FindWindow("XLMAIN", Application.Caption)
hWnd(2) = FindWindowEx(hWnd(1), ByVal 0&, "XLDESK", vbNullString)
hWnd(3) = FindWindowEx(hWnd(2), ByVal 0&, "EXCEL7", ActiveWindow.Caption)
SetWindowLong hWnd(3), -16, GetWindowLong(hWnd(3), -16) And Not &HC00000
End Sub

MP

"Yury Lobanov" a écrit dans le message de
...
Not to find how to trap window closing i'm trying to disable "X"-button,
and System menu. With API.

API's "RemoveMenu" works with Forms but not with Worksheet Windows!!!
"X"-button can be disabled, but System Menu - can't!!

is it impossible to remove items of System Menu of a Worksheet Window????

Yury




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 PDF menu Gene Augustin Excel Discussion (Misc queries) 1 February 15th 09 04:55 PM
Drop dwn menu. Formula to count selection frm menu in anoth cell? ggoldber Excel Worksheet Functions 1 June 4th 08 02:21 PM
Remove element from menu Dominic Excel Discussion (Misc queries) 1 February 1st 06 08:25 PM
Remove custom menu Excel Discussion (Misc queries) 5 March 8th 05 05:06 PM
Menu items added with menu item editor in older versions Michael Hoffmann Excel Discussion (Misc queries) 2 January 7th 05 01:40 PM


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