Re: Can I call an Excel VBA function from within a WebBrowser control?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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



.



Relevant Pages

  • Re: Can I call an Excel VBA function from within a WebBrowser control?
    ... I looked at the source code for you posting and found this ... Once you find the workbook name then the application is what you need ... I not an expert on Java and not sure how to test my theory. ...
    (microsoft.public.excel.programming)
  • Re: Something has to be tested and maintained was Re: GoTo in Java
    ... I am on record as saying that maintenance of source code is self defeating. ... every module or program when new functionality is added. ... is that a brick is a brick; it has the attributes and behaviours of a brick. ... to translate it to Java, and get something not too bad. ...
    (comp.lang.cobol)
  • Re: GoTo in Java
    ... >> to translate it to Java, and get something not too bad. ... > your 'cleaned up' Java now works the same as the Fortran code. ... NOT maintain source code. ... Encapsulate functionality and reuse it. ...
    (comp.lang.cobol)
  • Something has to be tested and maintained was Re: GoTo in Java
    ... to translate it to Java, and get something not too bad. ... Source code translations have been tried for several decades and they ... Because of its COBOL and procedural programming roots, ... Encapsulate functionality and reuse it. ...
    (comp.lang.cobol)
  • Run-time error -2147221080 (800401a8): Automation error
    ... I have ran into this issue with one of the Excel files that I have setup VBA ... One server side file, which this file's main job is to gather all of the new ... Now I have created a file to summarize the data. ... The server side workbook ...
    (microsoft.public.excel.programming)