
Disabling Close button on form
Hank
Thanks for the input.
I think I erred in describing the button. It is actually
a floating commandbar created with the following code:
Function CreateCloseButton()
Dim Combar As CommandBar
Dim strComBarName As String
'first get rid of old Monitor buttons
strComBarName = "Save and Close"
For Each Combar In Application.CommandBars
If Combar.Name = strComBarName Then
CommandBars(strComBarName).Delete
End If
Next Combar
'create Close Button
'create floating Close button
Application.CommandBars.Add
(Name:="Save and Close", Position:=msoBarFloating).Enabled
= True
Application.CommandBars("Save and
Close").Visible = True
Set Combar = Application.CommandBars("Save
and Close")
With Combar
.Controls.Add
(Type:=msoControlButton).Caption = "Print"
.Controls("Print").Style =
msoButtonCaption
.Controls("Print").OnAction
= "PrintCurrentSheet"
.Controls.Add
(Type:=msoControlButton).Caption = "Save, stay open"
.Controls("Save, stay open").Style
= msoButtonCaption
.Controls("Save, stay
open").OnAction = "SaveOpenFile"
.Controls.Add
(Type:=msoControlButton).Caption = "Close, Do Not Save"
.Controls("Close, Do Not
Save").Style = msoButtonCaption
.Controls.Add
(Type:=msoControlButton).Caption = "Save and Close"
.Controls("Save and Close").Style
= msoButtonCaption
End With
Application.CommandBars("Save and
Close").Height = 50
Application.CommandBars("Save and
Close").Width = 0
End Function
Can I add anything to the code at this point to do as you
suggested?
I cannot use a form as a visible form retains the focus
and prohibits the user from working on his spreadsheet.
Therefor I am using a floating Command Bar.
Can you help?
Lionel
Quote:
>-----Original Message-----
>Message unavailable