Hi, I want to develop a COM dll for Excel. When I start VB6, I choose
Addin project and I manage to transform it to load with Excel doing the
code below...
The problem is that I don't know how to launch a form... I trie to adapt
template code, but it doesn't work...
How to adapt this for Excel ?
If mfrmAddIn Is Nothing Then
Set mfrmAddIn = New frmAddIn
End If
Set mfrmAddIn.VBInstance = VBInstance
Set mfrmAddIn.Connect = Me
FormDisplayed = True
mfrmAddIn.Show
'----------------------------------------------------------------------------
'Code
'----------------------------------------------------------------------------
Public FormDisplayed As Boolean
Public WithEvents m_objCommandBarButton As CommandBarButton
Public m_objApplication As Excel.Application
Dim mfrmAddIn As New frmAddIn
Private Sub AddinInstance_OnConnection(ByVal Application As Object, _
ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _
ByVal AddInInst As Object, custom() As Variant)
Dim objCommandBar As CommandBar
Set m_objApplication = Application
' The button will be added as the last button of the Standard toolbar
Set objCommandBar = m_objApplication.CommandBars.Item("Standard")
Set m_objCommandBarButton =
objCommandBar.Controls.Add(Type:=msoControlButton)
m_objCommandBarButton.Caption = "MyExcelButton"
m_objCommandBarButton.FaceId = 225 ' Sum icon
End Sub
Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As _
AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
m_objCommandBarButton.Delete
End Sub
Private Sub m_objCommandBarButton_Click(ByVal Ctrl As _
Office.CommandBarButton, CancelDefault As Boolean)
---> PROBLEM
End Sub