Re: Can I call an Excel VBA function from within a WebBrowser control?
- From: "Tim Williams" <timjwilliams@xxxxxxxxxxx>
- Date: Tue, 20 Oct 2009 22:01:13 -0700
I've tried this without success in the past, but your question got me
searching again....
Here's a page explaining how to fire a method in VB from javascript in a
hosted browser control:
http://msdn.microsoft.com/en-us/library/aa752045(VS.85).aspx
It's a bit complex, but easy enough to follow: you can just copy and paste
the code from the link.
One difference in VBA: you can't set the default member of a class via the
Object browser in VBA, so use the method described here:
http://www.cpearson.com/excel/DefaultMember.aspx
It involves exporting the class to a file, then editing and re-importing it.
Worked for me when I tried in XL. I can send you my file if you're having
problems.
Tim
timjwilliams
at
gmail dot com
"John Brock" <jbrock@xxxxxxxxx> wrote in message
news:hbkmbp$l9r$1@xxxxxxxxxxxxxxxxxxxx
Thanks for the suggestions, but unfortunately they just seem to
throw errors.
Where did you get the "onclick=..." line??? It doesn't seem to be
in the link I posted.
In article <joel.40d2d8@xxxxxxxxxxxxxxx>,
joel <joel.40d2d8@xxxxxxxxxxxxxxx> wrote:
I looked at the source code for you posting and found this
onclick='javascript:this.parentNode.parentNode.style.display="none";
I believe if you displayed in Java "this.parentNode.Name" it would be
the workbook name. If not then try the 2nd parent
"this.parentNode.parentNode.Name"
Once you find the workbook name then the application is what you need
to run
from
App.Run(VBAMacroName);
to
this.parentNode.Application.Run(VBAMacroName);
what also may work is
this.Application.Run(VBAMacroName);
I not an expert on Java and not sure how to test my theory.
--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread:
http://www.thecodecage.com/forumz/showthread.php?t=145854
--
John Brock
jbrock@xxxxxxxxx
.
- Follow-Ups:
- References:
- Prev by Date: Re: Counting Work Days
- Next by Date: Macro for fast deletion of rows that conatin certain data.
- Previous by thread: Re: Can I call an Excel VBA function from within a WebBrowser control?
- Next by thread: Re: Can I call an Excel VBA function from within a WebBrowser control?
- Index(es):
Relevant Pages
|