PropertyPage calls Addin Sub?

M

MatrimCauthon

Hello,

I created the Option PropertyPage (it has to be a standalone Active
(ocx)?).
But I dont want to add multiple functions in my addin and the propert
page.
So how can I pass value or call public subs from within the propert
page?

Thank you,

Mat
 
E

Eric Legault [MVP - Outlook]

If you set a reference to your .ocx in your project, you will be able to
declare a variable based on that reference. i.e. Dim objMyOCX as myOCX.
Any exposed classes or public methods will be accessible through that object
or its children and can be used by the code in your project.
 
K

Ken Slovak - [MVP - Outlook]

The OCX can access public properties or methods in the DLL, either in the
designer class module or in a separate class module that is exposed in the
designer class module. I do that all the time. For example...

In the designer:
Public Sub DoSomething() 'can have passed arguments in the sub too
On Error Resume Next
Call MyMethod 'code in the DLL that does something
End Sub

In On_Connection():
AddInInst.Object = Me

OCX module level declarations:
Implements Outlook.PropertyPage
Private oCOMAddin As Object
Private m_Site As Outlook.PropertyPageSite

In the OCX's InitProperties event handler:

Dim oOL As Outlook.Application

Set m_Site = Parent
Set oOL = m_Site.Application
Set oCOMAddin = oOL.COMAddins(myAddinName.Connect).Object
'can now call DoSomething in the DLL at any point in the OCX code

You can be quite elaborate in the interface, I often pass CDO Sessions and
various other objects or collections and use various public methods and
properties that can be passed or set in either direction.
 

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