Link to home
Start Free TrialLog in
Avatar of bvallanc
bvallancFlag for United States of America

asked on

Pass VBA UserForm Selected Listbox Item Value To ThisOutLookSession Module

In Outlook 2007 I have created a VBA UserForm (UserForm1) on which I have placed a single-column Listbox control (Listbox1).  I populate the Listbox conrol with the FullName of each Contact that is present in the Contacts folder.  This works without problem.

When I select one of the Contacts in the Listbox located on the VBA UserForm (Listbox1), I need to pass the value for the selected Listbox item to the VBA code running in the ThisOutlookSession module.  Is this even possible?  If so, what does the code look like?

Thanks,

Bill Vallance
ASKER CERTIFIED SOLUTION
Avatar of englanddg
englanddg

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bvallanc

ASKER

This works when the code is created in a Module.  It doesn't seem to work if the code is created in ThisOutLookSession (I've created all of my code (so far) in ThisOutLookSession).  Is this correct?
Avatar of englanddg
englanddg

Do you mind posting your code?

As far as I know, a public module is the best solution.  At least...it's the solution that will work!
Thanks, englanddg, for your answer.  I was hoping that someone would specifically answer my question about how to communicate between a standard Module and the ThisOutLookSession module.  Since I have taken your advice and placed my code in a standard Module I think it's fair to award 50% of the points for your time and effort.

Thanks for your help!

Bill Vallance
Englanddg, you got all 400 points because I don't have the time to screw around with allocating points.  Thanks so much for your help with this problem.
Regards,

Bill Vallance