Solved

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

Posted on 2009-05-19
3
560 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 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