View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default code that might be causing error - please review and comment

It looks okay. Where does that second block of code reside? What error do
you get?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"bruce forster" wrote in message
...
below are sections of code that might me causing my error when I close

excel;

THIS IS IN MY WORKBOOK MODULE

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call DeleteMenuBar
End Sub

FOLLOWING ARE PORTIONS OF MY MENU MODULE RELATED TO DELETING THE MENU BAR

AND THE WORKBOOK_BEFORE CLOSE CODE

' Delete menu bar if it exists
Call DeleteMenuBar
' Add a new menu item
Set NewItem = NewMenu.Controls.Add(Type:=msoControlButton)
With NewItem
.Caption = "&Restore Normal Menu"
.OnAction = "DeleteMenuBar"
End With
End Sub

Sub DeleteMenuBar()
On Error Resume Next
CommandBars("MyMenuBar").Delete
On Error GoTo 0
End Sub

please advise if you can see if any of this code could be causing an error

to occur when i try to close my excel file without saving (X in top right
corner) or attempting to "save as"

Thanks