Debug ActiveX object

C

Carlos

Hello

I add in worksheet one combobox (Forms not Control ToolBox) with the
properties set via code.
I need to debug the code step by step in VBA IDE, but receved the message
("Can't enter break code at this time.") when the code enter in the combo
box properties.

Is a way to Debug the code step by step in VBA IDE

thank's
 
O

onedaywhen

ActiveX controls are from the Controls ToolBox, not the Forms toolbar
(but if you are adding them dynamically you are using neither
toolbar!). If you really do mean ActiveX controls then no, you can't
step through your code because OLEObjects that get added
programmatically aren't fully mature in the eyes of the code engine
(to quote Excel MVP, Dick Kusleika) at this time.

As a workaround, you could strategically add lines of code to print
information to the VBE Immediate Window at run-time using Debug.Print
i.e.

Sub test()
Dim oOle As Object
Set oOle = Sheet1.OLEObjects.Add("Forms.OptionButton.1")
Debug.Print oOle.Name
oOle.Name = "NewNameHere"
Debug.Print oOle.Name
End Sub
 
C

Carlos

Thank's for infomation


onedaywhen said:
ActiveX controls are from the Controls ToolBox, not the Forms toolbar
(but if you are adding them dynamically you are using neither
toolbar!). If you really do mean ActiveX controls then no, you can't
step through your code because OLEObjects that get added
programmatically aren't fully mature in the eyes of the code engine
(to quote Excel MVP, Dick Kusleika) at this time.

As a workaround, you could strategically add lines of code to print
information to the VBE Immediate Window at run-time using Debug.Print
i.e.

Sub test()
Dim oOle As Object
Set oOle = Sheet1.OLEObjects.Add("Forms.OptionButton.1")
Debug.Print oOle.Name
oOle.Name = "NewNameHere"
Debug.Print oOle.Name
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top