OFFICE 2007 CUSTOM TASK PANES AND VB6


C

ctorres

I developed a Microsoft Office solution using Visual Basic 6 and Excel-addin
(VBA). The original system works well with Excel 2003 and previous versions.

Currently, my company is migrating to Office 2007 and I want take advantage
of new Office’s ribbon and custom task panes. Firstly, I tried to do this,
using Visual Basic 2005 and Visual Studio Tools for Office SE. Unfortunately,
at the end of the development I found that trying to deploy the application
implies so many prerequisites that I finally decided go back to the original
solution developed in Visual Basic 6.

Manage Office ribbon is not a problem for VB6. However, I can’t generate a
custom task pane using a VB6 User control. A runtime error ‘-2147467259
(80004005)’ Unable to create specified Activex control, arises in the
procedure: Private Sub ICustomTaskPaneConsumer_CTPFactoryAvailable in the
line:

Set moCTP = CTPFactoryInst.CreateCTP("BUcp6.ctrlBUcp6", "BUcp6")

As you see at the code, previous line creates the same object without error.

I have been using “WROX: Excel 2007 VBA Programmer’s Referenceâ€

Do you have any suggestion?

Thanks in advance.
Carlos

Here the code:

'Implement an interface to tell Excel we're doing things with RibbonX
Implements IRibbonExtensibility
'Implement an interface to tell Excel we're doing things with Custom Task
Panes
Implements ICustomTaskPaneConsumer
'Store a reference to the ribbon, so we can invalidate controls when needed
Dim moRibbon As IRibbonUI
'Store a reference to the custom task pane
Dim WithEvents moCTP As CustomTaskPane
'Store a reference to the Excel application, with events
Dim WithEvents moXL As Excel.Application
Dim WithEvents moBU As BUcp6.ctrlBUcp6

'Called when the addin loads up, to provide the application object
Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal
ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As
Object, custom() As Variant)
Set moXL = Application
End Sub

'Called when the addin loads up, to provide a custom task pane factory.
Private Sub ICustomTaskPaneConsumer_CTPFactoryAvailable(ByVal CTPFactoryInst
As Office.ICTPFactory)
' The CLSID or ProgID of a Microsoft ActiveX® object
Dim o As Object
Set o = CreateObject("BUcp6.ctrlBUcp6")
Set moCTP = CTPFactoryInst.CreateCTP("BUcp6.ctrlBUcp6", "BUcp6")
Set moBU = moCTP.ContentControl
End Sub
 
Ad

Advertisements


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