![]() |
How do I call a VBA subroutine from Javascript
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? |
How do I call a VBA subroutine from Javascript
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. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "SteveR" wrote in message ... 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? |
How do I call a VBA subroutine from Javascript
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 "Ken Slovak - [MVP - Outlook]" wrote: 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. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "SteveR" wrote in message ... 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? |
How do I call a VBA subroutine from Javascript
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. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "SteveR" wrote in message ... 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 |
How do I call a VBA subroutine from Javascript
Understood and thanks for the reply. I'll see if the PPT General fourm has
an equivalent. sr "Ken Slovak - [MVP - Outlook]" wrote: 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. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "SteveR" wrote in message ... 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 |
All times are GMT +1. The time now is 03:36 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com