Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Outlook custom form - VBS call VBA macro

633 views
Skip to first unread message

JMat45

unread,
Jan 28, 2010, 10:42:02 PM1/28/10
to
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?
--
I ask, therefore I am.

Sue Mosher [MVP]

unread,
Jan 28, 2010, 11:20:15 PM1/28/10
to
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
http://www.outlookcode.com/article.aspx?id=54


"JMat45" <JMa...@discussions.microsoft.com> wrote in message
news:D0325B32-3A15-4E5B...@microsoft.com...

JMat45

unread,
Jan 31, 2010, 9:25:01 PM1/31/10
to
Ok, I will give that a try. Thanks for the advice.

--
I ask, therefore I am.


"Sue Mosher [MVP]" wrote:

> .
>

JMat45

unread,
Jan 31, 2010, 10:22:01 PM1/31/10
to
Sue, worked great. I'm back in business. Thanks very much.

--
I ask, therefore I am.

zsolt

unread,
Jun 25, 2011, 7:45:20 AM6/25/11
to
Sue Mosher [MVP] wrote on 01/28/2010 23:20 ET :
> 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
> http://www.outlookcode.com/article.aspx?idT
>
>
> "JMat45" wrote in message
> news:

>> 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?
>> I ask, therefore I am.
>>
>>
>
Dear Sue,

as a new member in this site I've met your answer regarding call VBA sub from
VBScript by using Application.MySub.

I tried it in Outlook 2007. The VBScript sub fires if I click a CommandButton.
The VBScript sub calls a Public sub in ThisOutlookSession by using
Application.MySub. But I get always a message that "This object doesn't
support this property or method: 'Application.Mysub' " (I re-translated the
message from Hungarian to English. Maybe the original one is a bit other).

Hiere is the VBScript content:

sub CommandButton4_Click

application.MySub

end sub

And here is the ThisOutlookSession module content (General):

Public Sub MySub()

MsgBox("Got it!")

End Sub

What I've made wrong?

Thnx for your answer in advance,

Zsolt

zsolt

unread,
Jun 26, 2011, 2:43:54 AM6/26/11
to
In the meantime I've found the solution: there were some security reasons,
such
as macro digitally subscribed and load VBA at startup. All I wanted to do run
perfectly.

Thnx again,

Zsolt
0 new messages