Outlook custom form - VBS call VBA macro



I have created a custom OL form based on the Contact form. I want to save
data from some of the fields to a text file. I want to initiate the save
using the WRITE event. I have written the SUB in VBA to save the data, but
can't call the SUB from the form VBS. What is the solution or workaround?

Sue Mosher [MVP]

If the Sub is a public Sub in the built-in ThisOutlookSession module, it
should be possible to call it as Application.MySub or whatever its name
is. --
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
Jan 11, 2012
Reaction score

I am unable to get this to work. My Outlook macro is called "Public Sub TestBCM()" and is in the ThisOutlookSession module. It just consists of a MsgBox. In VBS, I have the following code:

Set objOutlook = CreateObject("Outlook.application")

I also tried just "objOutlook.TestBCM" on the second line. Neither worked. Anyway, if Sue or someone else has ideas about how I can get the code working, please let me know! Thanks very much.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question