Property Page problem

  • Thread starter Thread starter mookashi
  • Start date Start date
M

mookashi

hi,
im adding a new property page to the Tools/Option Menu
after having written the code, when im trying to view the page i ca
see the property page as one of the tabs in the Options menu, it doe
not allow me to view that page it displays an error like this:

Unable to display "My Property Page" page. This page will remai
visible, but is not available.

What is this all about?
 
You can set up a public class module in your addin DLL that is
available in your property page or even just declare public properties
in the designer module in your addin DLL project and read and set them
in the property page. The code in the public properties can call
procedures in your addin. I use that method all the time.

Here's how it works:

In the designer module:
Public Property Get Setting() As String 'can be any item type
On Error Resume Next
GetSetting = g_strVariable
'can also be an object or anything else
End Property

Public Property Let GetSetting(strSetting As String)
On Error Resume Next
Call SomeCodeProcedure(strSetting)
End Property

Module level declarations in the UserControl:
Private objSite As Outlook.PropertyPageSite
Private m_oAddinBase As Object

Now in the InitProperties event in the OCX:
Private Sub UserControl_InitProperties()
Dim objOL As Outlook.Application
Dim strSetting As String

On Error Resume Next

Set objSite = Parent
Set objOL = objSite.Application

Set m_oAddinBase = objOL.COMAddIns("MyProjectName.Connect").Object
If Not (m_oAddinBase Is Nothing) Then
strSetting = m_oAddinBase.GetSetting
End If

'whatever other code you need
 
Back
Top