How do I call a VBA subroutine from Javascript

S

SteveR

I have a VBA form that includes a webbrowser control. In the webbrowser
document I've written a Javascript function that, when called, should pass
information to a subroutine in the VBA. How can this be done?
 
K

Ken Slovak - [MVP - Outlook]

This form is in the Outlook VBA project? If so then put a public method in
the ThisOutlookSession class module that you can call from outside and have
that method call whatever you need on the UserForm.

To call a public method in the Outlook VBA in ThisOutlookSession you call it
this way after you get a reference to the Outlook.Application object. Say
olApp is your Outlook.Application object you'd call method Foobar() this
way:

olApp.Foobar()

Of course you also have to make sure that what you pass to that method is
type consistent with what VBA expects and can handle.
 
S

SteveR

Well, darn... you caught me!! This was actually for a PowerPoint
application but I didn't see a PowerPoint VBA section and hoping it would be
the the same. So, basically you're saying I need to get a reference (in
Javascript) to the application object and then I can call a method within it.

sr
 
K

Ken Slovak - [MVP - Outlook]

Yes, but only if the code is in the ThisOutlookSession class of the Outlook
VBA project. It might or might not work in some other application's VBA
project, that's not an Outlook question.
 
S

SteveR

Understood and thanks for the reply. I'll see if the PPT General fourm has
an equivalent.

sr
 

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

Top