Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Custom Menu Bar

Hi all,

How do I go about removing/disabling the built-in controls that appear on
the right of a custom menu bar (x- etc).

Regards
Don


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Custom Menu Bar

Application.CommandBars("Cell").Controls("Insert") .Enabled=False

etc.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Don Lloyd" wrote in message
...
Hi all,

How do I go about removing/disabling the built-in controls that appear on
the right of a custom menu bar (x- etc).

Regards
Don




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Custom Menu Bar

Hi,

Not really what I'm after. I'm replacing the Worksheet Menu Bar with a
customised one(s) and want to Hide/Disable the controls that appear on the
right hand side - i.e (Minimise, Maximise, Close). Can this be done and if
so, how ?

regards,
Don

"Bob Phillips" wrote in message
...
Application.CommandBars("Cell").Controls("Insert") .Enabled=False

etc.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Don Lloyd" wrote in message
...
Hi all,

How do I go about removing/disabling the built-in controls that appear on
the right of a custom menu bar (x- etc).

Regards
Don






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Custom Menu Bar

This code disables/re-enables them

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, _
ByVal bRevert As Integer) As Integer

Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Integer, _
ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer

Sub Disable_Control()
Dim X As Integer, hwnd As Long
hwnd = FindWindow("XLMain", Application.Caption)
For X = 1 To 9
'Delete the first menu command and loop until
'all commands are deleted
Call DeleteMenu(GetSystemMenu(hwnd, False), 0, 1024)
Next X
End Sub

Sub RestoreSystemMenu()
Dim hwnd As Long
Dim hMenu
'get the window handle of the Excel application
hwnd = FindWindow("xlMain", Application.Caption)
'restore system menu to original state
hMenu = GetSystemMenu(hwnd, 1)
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Don Lloyd" wrote in message
...
Hi,

Not really what I'm after. I'm replacing the Worksheet Menu Bar with a
customised one(s) and want to Hide/Disable the controls that appear on the
right hand side - i.e (Minimise, Maximise, Close). Can this be done and if
so, how ?

regards,
Don

"Bob Phillips" wrote in message
...
Application.CommandBars("Cell").Controls("Insert") .Enabled=False

etc.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Don Lloyd" wrote in message
...
Hi all,

How do I go about removing/disabling the built-in controls that appear

on
the right of a custom menu bar (x- etc).

Regards
Don








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Custom Menu Bar

Wow !!! Why din't I think of that ?

Bob, many thanks for al the trouble you went to.

Don
"Bob Phillips" wrote in message
...
This code disables/re-enables them

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, _
ByVal bRevert As Integer) As Integer

Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Integer, _
ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer

Sub Disable_Control()
Dim X As Integer, hwnd As Long
hwnd = FindWindow("XLMain", Application.Caption)
For X = 1 To 9
'Delete the first menu command and loop until
'all commands are deleted
Call DeleteMenu(GetSystemMenu(hwnd, False), 0, 1024)
Next X
End Sub

Sub RestoreSystemMenu()
Dim hwnd As Long
Dim hMenu
'get the window handle of the Excel application
hwnd = FindWindow("xlMain", Application.Caption)
'restore system menu to original state
hMenu = GetSystemMenu(hwnd, 1)
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Don Lloyd" wrote in message
...
Hi,

Not really what I'm after. I'm replacing the Worksheet Menu Bar with a
customised one(s) and want to Hide/Disable the controls that appear on
the
right hand side - i.e (Minimise, Maximise, Close). Can this be done and
if
so, how ?

regards,
Don

"Bob Phillips" wrote in message
...
Application.CommandBars("Cell").Controls("Insert") .Enabled=False

etc.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Don Lloyd" wrote in message
...
Hi all,

How do I go about removing/disabling the built-in controls that appear

on
the right of a custom menu bar (x- etc).

Regards
Don










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
Adding Sub Menu Item to Current Custom Menu Renato Excel Programming 2 December 19th 05 12:48 AM
Custom menu Alan M Excel Worksheet Functions 4 September 18th 05 11:57 PM
VBA - Disappearing custom menu and custom toolbar Peter[_50_] Excel Programming 2 December 2nd 04 06:09 PM
Custom Menu return to Excel Menu upon Closing VetcalcReport Excel Programming 2 August 2nd 04 02:59 PM
Custom Menu Luis Excel Programming 1 December 12th 03 01:54 PM


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