Thanks! but i am not able to resolve this still.
I tried executing step by step. If i have only the msgbox statement it works fine but when some control is added or some iteration like foreach myworks in application.workbook is done this method gets indefinite call leading to idefinite number of excel object created.
Does it mean that we cannot create a control using this activeX dll here.
Can you please have a look of the code below and give me some suggestion
Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
MsgBox "AddinInstance_OnConnection"
'Code to create control
'Set CBar = CommandBars("Simple AddIns")
Set CBar = CommandBars.Add(Name:="Simple AddIns Toolbar", Position:= _
msoBarFloating)
CBar.Visible = True
Set CBarCtl = CBar.Controls.Add(Type:=msoControlButton)
With CBarCtl
.FaceId = 23
.Caption = "Show Message"
.ToolTipText = "Welcomes the user"
.OnAction = "showMessage"
End With
Set excelapp = Application
End Sub
Also please let me know where I am doing a mistake.
Thanks,
ram