Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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.
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
What's causing error message? Jim Tibbetts Excel Worksheet Functions 4 November 12th 08 06:13 PM
What does Show Ink in Excel, Review Tab, comment, do? E. Duke 462 Excel Worksheet Functions 0 August 8th 08 04:31 PM
Halt Rest of Macro after Error €“ Jim Cone review Jenny B. Excel Discussion (Misc queries) 2 January 12th 08 03:11 AM
VB6 with Excel Objects: Please review my code Kurt Remlin Excel Programming 6 May 1st 04 03:36 AM
ChartCalculate code causing error when saving workbook Pete McCosh[_5_] Excel Programming 0 February 19th 04 03:00 PM


All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"