+ Reply to Thread
Results 1 to 3 of 3

Can't enter break mode at this time

  1. #1
    CWillis
    Guest

    Can't enter break mode at this time

    I am creating a text box in excel using the following code:

    ActiveSheet.OLEObjects.Add(ClassType:="Forms.TextBox.1", Link:=False, _
    DisplayAsIcon:=False, Left:=3.75, Top:=722.25, Width:=222, Height:= _
    87.75).Select

    Question 1:
    Stepping through the code gives the "Can't enter break mode at this time"
    error. I would ignore it, but I need to step through the code to find out
    what is causing my other errors.

    Question 2: In the above code, it places the text box in the location I
    tell it. (Left=, Top=....) This is referenced from cell A1. Is there a way
    for the text box to be placed in a specific cell? (Or be referenced from a
    cell other than A1.).

    Thanks in advance.

  2. #2
    Dave Peterson
    Guest

    Re: Can't enter break mode at this time

    #1. I set a break point before the offending line and after the offending line
    and run (F5) that offending line without stepping through it.

    #2. I like to use a variable that represents the object. Then I can use that
    variable to do other things, too.

    Option Explicit
    Sub testme()

    Dim myRng As Range
    Dim OLEObj As OLEObject

    Set myRng = ActiveSheet.Range("b9")

    With myRng
    Set OLEObj = .Parent.OLEObjects.Add(ClassType:="Forms.TextBox.1", _
    Link:=False, DisplayAsIcon:=False, _
    Left:=.Left, _
    Top:=.Top, _
    Width:=.Width, _
    Height:=.Height)

    OLEObj.Name = "TextBoxIn_" & .Address(0, 0)
    End With

    End Sub

    CWillis wrote:
    >
    > I am creating a text box in excel using the following code:
    >
    > ActiveSheet.OLEObjects.Add(ClassType:="Forms.TextBox.1", Link:=False, _
    > DisplayAsIcon:=False, Left:=3.75, Top:=722.25, Width:=222, Height:= _
    > 87.75).Select
    >
    > Question 1:
    > Stepping through the code gives the "Can't enter break mode at this time"
    > error. I would ignore it, but I need to step through the code to find out
    > what is causing my other errors.
    >
    > Question 2: In the above code, it places the text box in the location I
    > tell it. (Left=, Top=....) This is referenced from cell A1. Is there a way
    > for the text box to be placed in a specific cell? (Or be referenced from a
    > cell other than A1.).
    >
    > Thanks in advance.


    --

    Dave Peterson

  3. #3
    CWillis
    Guest

    Re: Can't enter break mode at this time

    Thanks Dave. I haven't tried it yet since it won't open up the page I need
    (See above new post) but I will try it as soon as I can.
    "Dave Peterson" wrote:

    > #1. I set a break point before the offending line and after the offending line
    > and run (F5) that offending line without stepping through it.
    >
    > #2. I like to use a variable that represents the object. Then I can use that
    > variable to do other things, too.
    >
    > Option Explicit
    > Sub testme()
    >
    > Dim myRng As Range
    > Dim OLEObj As OLEObject
    >
    > Set myRng = ActiveSheet.Range("b9")
    >
    > With myRng
    > Set OLEObj = .Parent.OLEObjects.Add(ClassType:="Forms.TextBox.1", _
    > Link:=False, DisplayAsIcon:=False, _
    > Left:=.Left, _
    > Top:=.Top, _
    > Width:=.Width, _
    > Height:=.Height)
    >
    > OLEObj.Name = "TextBoxIn_" & .Address(0, 0)
    > End With
    >
    > End Sub
    >
    > CWillis wrote:
    > >
    > > I am creating a text box in excel using the following code:
    > >
    > > ActiveSheet.OLEObjects.Add(ClassType:="Forms.TextBox.1", Link:=False, _
    > > DisplayAsIcon:=False, Left:=3.75, Top:=722.25, Width:=222, Height:= _
    > > 87.75).Select
    > >
    > > Question 1:
    > > Stepping through the code gives the "Can't enter break mode at this time"
    > > error. I would ignore it, but I need to step through the code to find out
    > > what is causing my other errors.
    > >
    > > Question 2: In the above code, it places the text box in the location I
    > > tell it. (Left=, Top=....) This is referenced from cell A1. Is there a way
    > > for the text box to be placed in a specific cell? (Or be referenced from a
    > > cell other than A1.).
    > >
    > > Thanks in advance.

    >
    > --
    >
    > Dave Peterson
    >


+ Reply to Thread

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