![]() |
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.TextB ox.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. |
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.TextB ox.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 |
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.TextB ox.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 |
All times are GMT +1. The time now is 03:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com