![]() |
code that might be causing error - please review and comment
below are sections of code that might me causing my error when I close excel
THIS IS IN MY WORKBOOK MODUL Private Sub Workbook_BeforeClose(Cancel As Boolean Call DeleteMenuBa End Su FOLLOWING ARE PORTIONS OF MY MENU MODULE RELATED TO DELETING THE MENU BAR AND THE WORKBOOK_BEFORE CLOSE COD ' Delete menu bar if it exist Call DeleteMenuBa ' Add a new menu ite Set NewItem = NewMenu.Controls.Add(Type:=msoControlButton With NewIte .Caption = "&Restore Normal Menu .OnAction = "DeleteMenuBar End Wit End Su Sub DeleteMenuBar( On Error Resume Nex CommandBars("MyMenuBar").Delet On Error GoTo End Su 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 |
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 |
code that might be causing error - please review and comment
Hi
code looks o.k. What exact error do you receive (and in which line) -- Regards Frank Kabel Frankfurt, Germany "bruce forster" schrieb im Newsbeitrag ... 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 |
code that might be causing error - please review and comment
When i try to close my excel file i often times get an error message "An error has been encountered and needs to close...: and there is an option box to restart excel. Any ideas why this happens?
There is no prompt to debug. A pop up box displays with text that says "An error has been encountered and needs to close..." The second block of code is in a module that controls a custom menu bar. Could there be a problem with Sub DeleteMenuBar() code? Any suggestions are appreciated. |
code that might be causing error - please review and comment
When i try to close my excel file i often times get an error message "An error has been encountered and needs to close...: and there is an option box to restart excel. Any ideas why this happens?
There is no prompt to debug. A pop up box displays with text that says "An error has been encountered and needs to close..." Any suggestions are appreciated. |
All times are GMT +1. The time now is 01:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com