Solved

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

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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to expand the inbox sub folders outlook 2016 1 42
Outlook 2016 stops working 19 80
outlook, autodiscover 1 53
Transfer Outlook 2013 Autofill data 6 15
If you don't know how to downgrade, my instructions below should be helpful.
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…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
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…

739 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