Solved

How do I Call an Outlook 2007 VBA Macro from Outlook Forms VBScript Code?

Posted on 2009-05-19
3
559 Views
Last Modified: 2012-05-07
I need to call an Outlook 2007 VBA procedure ('macro') from a button on a custom Outlook 2007 form, AND pass an argument value from a custom field/column on that form to the VBA procedure.  I can't seem to locate the way to do this in the welter of object model hash from the MS site.
All suggestions gratefully accepted.
0
Comment
Question by:dapathome
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 24425407
Hi, dapathome.

You can call a VBA procedure from a custom Outlook form.  The VBA procedure must be in the ThisOutlookSession module and you must call it like this

    Application.My_Procedure_Name

For example, if your procedure is named HelloWorld, then the call would be

    Application.HelloWorld

You can also pass a value to the procedure.  If you wanted to pass the value that's in a textbox named TextBox1, then you'd use something like this

    varValue = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1").Value
    Application.HelloWorld(varValue)
0
 

Author Closing Comment

by:dapathome
ID: 31583143
Worked perfectly.  Sorry it took me so long to get back to you.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24534576
No problem!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Resolve DNS query failed errors for Exchange
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now