Solved

Excel/VBA Message - "Can't enter break mode at this time"

Posted on 2002-07-01
5
1,334 Views
Last Modified: 2012-08-13
I have a workbook with (among others) worksheets named 'Week 1' to 'Week 13'
There is a menu from which a user can select to 'Move on a week'
In this process 'Week 1' is removed, Week 2' becomes Week 1 etc and a formatted but blank sheet becomes week 13.

The macro code is meant to :-
1. cut out all the controls on worksheet 'Week 1' (Combo boxes, buttons etc)
2. delete all VBA code from the worksheet ('Week 1')
3. move 'Week 1' to a new book, (which will then be saved and closed)

the process should happen in that order but in any order, the message 'Can't enter break mode at this time' is displayed. When I click continue, the process then runs on, but I want to remove this problem because the users will start laying duckeggs.
It doesn't matter by the way if I take out process 1 or processes 1 and 2 the message always comes up. I'd be grateful for any incites.

0
Comment
Question by:macbone2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 7122442
Hi macbone2,

some thought and some reading of several posts on this error let me to this (could be totally wrong here)

this is a post with some methods to relieve you from your problem

question:
When the following command line is executed, "Can't break mode at this time" message with Continue, End, and Help enabled appears. I don't know why this happens.

ThisWorkbook.Worksheets("Master Invoice").Copy _
after:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)

The thing is that I made a reference to another workbook and switch between the referring and the referred workbooks quite often. I wonder if that might cause "Can't break mode at this time" message...

Worksheets("Master Invoice") contains three worksheet-level names and a picture. Since I want to keep those in newly created worksheets, I like to use the method of "Copy after:=", rather than "worksheets.add & 
.cells.copy " which doesn't copy the picture and incorrectly define names.
---


Response 1:
As I expected I had no problems running this code. If there is a possibility of confusion concerning which is 'ThisWorkbook' you might be better off creating a
variable for the workbook object,

Dim wbkCurrent As Workbook
Set wbkCurrent = Workbooks("Current.xls")
With wbkCurrent
.Worksheets("Master Invoice").Copy _
after:=.Worksheets(.Worksheets.Count)
End With
Set wbkCurrent = Nothing
---

Response 2:
I use xl97sr2 and never had a problem with a macro that copied another workbook.worksheet into a different workbook.

then one day, I started getting this error.

The suggestion was to turn off the "require variable declaration" in side Tools|options of the VBE.

I did that and it worked ok ever since. (Although I do have to type "option explicit" for each module.)

---------------

read all this and more, but what seems to be the problem is that you delete a sheet in the workbook and excel still needs some variables in it, on the deletion or the move to the other workbook it could be that excel is confused about the variables  

just a thought

HAGD:O)Bruintje
0
 
LVL 2

Author Comment

by:macbone2
ID: 7123374
Hi Brian,
Thanks for your response. The error comes up even before I try to Move the sheet. It happens when I try to 'Cut' the controls out of the sheet, or if I skip that code and try to delete the vba code. I think it's something to do with the Worksheet code attempting to run, even though I start the macro with Application.EnableEvents = False.
It's got me baffled.
 Geoff
0
 
LVL 2

Author Comment

by:macbone2
ID: 7126798
The error first appears at the line Selection.cut in the following code (Sheet  "Week 1" has previously been selected in the current workbook)
CODE
On Error Resume Next
ActiveSheet.Shapes.SelectAll
Selection.Cut    '** 'Can't enter break mode at this time'
If Err.Number <> 0 Then
MsgBox "Error number " & Err.Number & vbLf & _
"Desc. " & Err.Description, vbOKOnly
End If

The process then runs on to end on selcting Continue. Is there a way of intercepting the dialog box. I can't trap it with on error. If I can intercept, I can possibly branch round it so the user doesn't have to.

0
 
LVL 44

Expert Comment

by:bruintje
ID: 7456759
Hello macbone2

this question is open for more then 2 months
time to clean up
if not stated otherwise

my recommendation will be
-PAQ and refund
-this will be finalized by an EE Moderator
-with no further update (23.11.2002)

PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER

HAGD:O)Bruintje
posted by ToolzEE v1.0
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 7488936
Per recommendation, points refunded and question closed.

Netminder
EE Admin
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will show you how to use shortcut menus in the Access run-time environment.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question