Results 1 to 6 of 6

"Can't enter break mode at this time" error

Threaded View

  1. #1
    Registered User
    Join Date
    04-08-2009
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    85

    "Can't enter break mode at this time" error

    Can someone please tell me why I get a "Can't enter break mode at this time" message when stepping through the following code (using the F8 key) at the 'With NewButton' line?

    (This is code from a Walkenbach book, and it runs fine if I don't step through it. I'm using Excel 2007 btw) Thanks!

    Sub AddButtonAndCode()
        Dim NewSheet As Worksheet
        Dim NewButton As OLEObject
        Dim Code As String
        Dim NextLine As Long
        Dim x
        
    '   Make sure access to the VBProject is allowed
        On Error Resume Next
        Set x = ActiveWorkbook.VBProject
        If Err <> 0 Then
            MsgBox "Your security settings do not allow this macro to run.", vbCritical
            On Error GoTo 0
            Exit Sub
        End If
    
    '   Add the sheet
        Set NewSheet = Sheets.Add
        
    '   Add a CommandButton
        Set NewButton = NewSheet.OLEObjects.Add _
          ("Forms.CommandButton.1")
        With NewButton
            .Left = 4
            .Top = 4
            .Width = 100
            .Height = 24
            .Object.Caption = "Return to Sheet1"
        End With
    Last edited by jp001; 04-16-2009 at 10:16 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1