Implementing IOlapAddIn

Place the following code in the Declarations section of the MyAddIn class:

Option Explicit

Implements IOlapAddIn

Const ThisAddInName = "My Sample AddIn"

Private m_SampleForms As Collection

Private Enum MenuActions

  mnuactRename = 1

  mnuactAddNewForm

  mnuactRefreshList

  mnuactDeleteSampleForm

  mnuactShowSampleForm

  mnuactShowTop

  mnuactShowCenter

  mnuactShowBottom

End Enum

 

Private Enum SampleIcons

  icoForms = 1

  icoForm

End Enum

 

In the Objects box, click IOlapAddIn.

In the Procedures box, select each method that the IOlapAddIn interface provides. This creates an implementation for each method within your class.

Add the following code to the Class_Initialize method:

Private Sub Class_Initialize()

  On Error GoTo Initialize_Err

 

  Set m_SampleForms = New Collection

  Dim frmSample As New SampleForm

  

  frmSample.Caption = "Sample Form 1"

  frmSample.Index = 1

  m_SampleForms.Add frmSample, "Sample Form 1"

  

  Exit Sub

Initialize_Err:

  Debug.Print Err.Number, Err.Description, Err.Source

  Debug.Assert False

  MsgBox "An Error Occurred in Class_Initialize"

  Err.Clear

  Exit Sub

End Sub

Add the following code to the IOlapAddIn_Name property method:

Private Property Get IOlapAddIn_Name() As String

  IOlapAddIn_Name = ThisAddInName

End Property

 

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.