Share class between VBA & VBScript? (to pass info from VBA form-->Outlookform)

A

Aaron Green

Hi,

In an effort to circumvent limitations of vbscript, I'm trying to use
VBA when possible in my Outlook project.

I have the following basic situation: a custom appointment form pops up
a VBA FORM that lets the user select an apporpriate CONTACT for the
appointment.

Have been messing with ways to pass the contact information back to the
outlooko form. What I've decided would LIKE to do is to have an instance
of a class (eg, myContact, which stores contact name and a custom
contact ID). The Outlook form could call getContact which would return
an item of this class. HOWEVER, it doesn't appear that I can pass either
a VBA class to VBScript or a VBScript class to VBA :(

Recommendations?

Thanks!
Aaron
 
A

Aaron Green

ADDENDUM: the problem I keep running into is that it appears VBScript
can see code ONLY from the "ThisOutlookSession" section in VBA, whereas
a VBA form can see code ONLY from form code and modules.

If I could create a persistent global var in ThisOutlookSession that
could be set by my VBA form, it would be helpful!
 
S

Sue Mosher [MVP-Outlook]

ThisOutlookSession *is* a class module, so any Public Function is callable
from either Outlook form VBScript (remember, this is unsupported) or any
other VBA module as Application.myprocedure. For example, I made this
procedure in ThisOutlookSession:

Public Function MyProp() As String
MyProp = "something"
End Function

And this code works from both a VBA userform and an Outlook form:

Sub CommandButton1_Click()
MsgBox Application.MyProp
End Sub
 

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