How do I call a VBA subroutine from Javascript

  • Thread starter Thread starter SteveR
  • Start date Start date
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?
 
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.
 
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
 
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.
 
Understood and thanks for the reply. I'll see if the PPT General fourm has
an equivalent.

sr
 
Back
Top