I ran across this little bug recently, while I was trying to incorporate a Microsoft Excel ActiveX automation server within my project.
If you declare a variable as a "Pane" object and you have the Microsoft Excel XX.0 Object Library as one of your References, you'll come across a nasty little run-time error 13. The example below causes the error.
'Docking pane declaration using Early-Binding (DOESN'T WORK) Dim TempPane As Pane Set TempPane = DockingPaneManager.CreatePane(ID_TEST, 50, 50, DockLeftOf, Nothing)
|
Why is the error caused? Quite simply because CodeJock decided to name their objects with rather standard names (i.e. "Pane"). Microsoft Excel also has an object named "Pane". Thus when you are declaring the object in the first line, it declares as an Excel pane, and then the docking pane manager tries use that object as a CodeJock pane.
How do you get around this error?? Use late-binding instead of early-binding. That means that you declare the variable as a standard object rather than a CodeJock "Pane" object.
'Docking pane declaration using Late-Binding Dim TempPane As Object
Set TempPane = DockingPaneManager.CreatePane(ID_TEST, 50, 50, DockLeftOf, Nothing)
|
The downside of this is that you'll loose the intellisense feature that is so handy in VB; but, at least your code will work.
Something tells me that CodeJock won't be fixing this little problem anytime soon as it requires renaming their object, which will undoubtedly break any existing code. It's too bad that they didn't have the fore-thought to assign unique names to their objects.
If this post helped you out, please reply.
|