A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How do I call a VBA subroutine from Javascript



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 18th 08, 02:55 PM posted to microsoft.public.outlook.program_vba
SteveR
external usenet poster
 
Posts: 8
Default 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?
Ads
  #2  
Old November 18th 08, 03:16 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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
news
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?


  #3  
Old November 18th 08, 07:02 PM posted to microsoft.public.outlook.program_vba
SteveR
external usenet poster
 
Posts: 8
Default 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
news
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?



  #4  
Old November 18th 08, 07:57 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


  #5  
Old November 18th 08, 09:18 PM posted to microsoft.public.outlook.program_vba
SteveR
external usenet poster
 
Posts: 8
Default 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



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OH YES I THINK THEY DID CALL MR BUT I DID NOT TALK TO THEM MY MAMA SAI CALL HER BACK LATER CUZ SHE IS DOING SOMETHG RIGHT NOW WHY DID YOU CALL ME NO THEIR IS ONLY ONE ME YES SIR Outlook Express 0 February 25th 07 09:12 AM
JavaScript Won't Change & Other Problems... BULLITTS Outlook Express 1 August 2nd 06 07:19 AM
Formatting Emails with JavaScript Morrie Williams Outlook Express 5 May 9th 06 01:00 AM
How do I get JavaScript to run in Outlook? Chris Mahoney Outlook - General Queries 5 April 18th 06 11:47 PM
outlook automation in javascript [email protected] Outlook - General Queries 1 April 7th 06 12:16 PM


All times are GMT +1. The time now is 10:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.