Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 575
  • Last Modified:

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

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
dapathome
Asked:
dapathome
  • 2
1 Solution
 
David LeeCommented:
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
 
dapathomeAuthor Commented:
Worked perfectly.  Sorry it took me so long to get back to you.
0
 
David LeeCommented:
No problem!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now