简体   繁体   中英

Adding Excel ActiveX Control using VBA

Using Excel 2010 VBA, Win 7 64bit

I'm using the following to add an ActiveX Label but get the error "Can't enter break mode at this time". Any insight as to what I'm doing wrong or a source to read about how to do this is appreciated.

Sub tester()

    Dim oLABEL As OLEObject
    Set oLABEL = ActiveSheet.OLEObjects.Add(classtype:="Forms.Label.1")

End Sub

It turns out that VBA gives that error when you try to step through adding an ActiveX control. If you just run it it works fine. When you step through and get that error you have the option to Continue but unfortunately it runs the rest of the code, ie not in step mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM