Solved

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

Posted on 2009-05-19
3
564 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
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 …
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

735 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