Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 7 of 7

Thread: "can't enter break mode at this time" error with VBA References

  1. #1
    Join Date
    18th November 2007
    Posts
    17

    "can't enter break mode at this time" error with VBA References

    Hi folks. I've just realized that I had originally posted in the wrong subforum so maybe that's why my question wasn't being answered

    further to my thread over here, I would like to know how to resolve the "can't enter break mode at this time" error.

    Basically, I'm trying to add/remove an Outlook Reference in my vba code but everytime I get to the part of my code that adds or removes the Reference, I get the "can't enter break mode at this time" error.

    I'm using this code
    VB:
     
    Sub TestOutlookReference() 
        Dim obj As Object 
        Dim sFind As Boolean 
        Application.DisplayAlerts = False 
        For Each obj In ThisWorkbook.VBProject.References 
            If obj.Name = "Outlook" Then 
                [COLOR=red]ThisWorkbook.VBProject.References.Remove obj[/COLOR] 
                 ' .References.Remove obj
                ThisWorkbook.VBProject.References.AddFromFile Application.Path & "\msoutl.olb" 
                sFind = True 
                Exit For 
            End If 
        Next obj 
        [COLOR=red] If sFind = False Then ThisWorkbook.VBProject.References.AddFromFile "C:\Program Files\Microsoft Office\OFFICE14\msoutl.olb"[/COLOR] 
        Application.DisplayAlerts = True 
    End Sub 
    
    
    I've hightlighted the lines where I get the error.

    As a note... the code does add/remove the Outlook Reference but the macro stops running after this error comes up.

    Have looked all over the web but can't seem to find any resolution to this issue I have also tried adding the reference using the GUID but I still get the same error.

    Would appreciate any/all help resoving this.

    Thanks in advance

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    1st September 2010
    Posts
    7,921

    Re: "can't enter break mode at this time" error with VBA References

    *Edit* Removed - misunderstood the question

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    2nd May 2008
    Location
    Ubique
    Posts
    1,894

    Re: "can't enter break mode at this time" error with VBA References

    Are you stepping through the code, or running it? Stepping through it won't work (and you would get that error) but running it should.
    Rory
    Theory is when you know something, but it doesnít work. Practice is when something works, but you donít know why. Programmers combine theory and practice: nothing works and they donít know why

  4. #4
    Join Date
    18th November 2007
    Posts
    17

    Re: "can't enter break mode at this time" error with VBA References

    D'oh!

    That was pretty silly of me.

    Thanks Rory, running the code (not debugging it) works flawlessly.

    Edit:

    Oops looks like I jumped the gun

    I've copied the code to my working file and I still get the same error (regardless of whether I step through the code or F5 it.)

    The workbook is meant to open other files and load a form. But since I added the code to check references the files open but form doesn't load anymore. It doesn't give any other error messages or anything

    Any clue how to fix that? Any breakpoints that I put in after the TestReferences code seems to get ignored as the code still goes to the file opening module
    Last edited by iLurk; April 12th, 2011 at 14:23.

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    1st September 2010
    Posts
    7,921

    Re: "can't enter break mode at this time" error with VBA References

    Time for you to upload an anonymous, sample workbook then - Rory's comment still holds so there must be some other issue affecting the form load...

    Excel Video Tutorials / Excel Dashboards Reports


  6. #6
    Join Date
    2nd May 2008
    Location
    Ubique
    Posts
    1,894

    Re: "can't enter break mode at this time" error with VBA References

    IMO, it would be a lot easier to late bind your Outlook objects than to try resetting references at runtime, especially as that requires the users to have access to the VBProject trusted.
    Rory
    Theory is when you know something, but it doesnít work. Practice is when something works, but you donít know why. Programmers combine theory and practice: nothing works and they donít know why

  7. #7
    Join Date
    18th November 2007
    Posts
    17

    Re: "can't enter break mode at this time" error with VBA References

    Hi guys. Thanks for your help. Sorry for the late reply I was away sick yesterday.

    After some trial and error (and a lot of googling), late binding seems to have sorted the problem for me

    This place is you're awesome! *Tips hat to Rory*

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Replies: 0
    Last Post: December 14th, 2007, 14:22
  2. "auto Enter" After "x" Characters Entered
    By bmd1 in forum EXCEL HELP
    Replies: 1
    Last Post: January 23rd, 2007, 07:21
  3. Can't Enter Break Mode at this time Error
    By Paraxiom in forum EXCEL HELP
    Replies: 25
    Last Post: February 9th, 2006, 14:15
  4. Replies: 2
    Last Post: August 27th, 2005, 19:19

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
  •  
porno