Hi everybody.
I'm working with excel vba over a web page. This page has a Javascript function "ButtonMovimenti()".
Is there a way to call that function from vba (I'm using the reference to Internet Explorer).
Thanks in advance
Hi everybody.
I'm working with excel vba over a web page. This page has a Javascript function "ButtonMovimenti()".
Is there a way to call that function from vba (I'm using the reference to Internet Explorer).
Thanks in advance
ALe
Help indigent families: www.bancomadreteresa.org
Well I solved it in a way but I still have some problem.
With this line the function is called:
the fact is that I get the result page without problem only if at least one item of the webpage is selected or has focus.Call IE.document.parentWindow.execScript("buttonMovimenti()", "JavaScript")
If no item has focus or selected than I'm sent to an error page.
you know why?
Last edited by Aussiebear; 02-18-2025 at 10:15 AM.
ALe
Help indigent families: www.bancomadreteresa.org
I don't know the 'why' as there is not enough information provided to even make a S.W.A.G. - but assuming the jscript function can be normally called within the DHTML, say by clicking a button or another object you can always use something like
which would then run the jscript..Document.GetElementsByTagName("TAG").Item(n).FireEvent("click()")
.02 Stan
Last edited by Aussiebear; 02-18-2025 at 10:15 AM.
stanl,
I had already tried it but it didn't work.
ALe
Help indigent families: www.bancomadreteresa.org
Hmmm. then perhaps something like (where myElement is a named element on the HTML page
Call IE.document.parentWindow.execScript("document.all.myElement.focus();buttonMovimenti();", "JavaScript")
this way it works
IE.document.all.Item Call IE.document.parentWindow.execScript("buttonMovimenti()", "JavaScript")
Last edited by Aussiebear; 02-18-2025 at 10:16 AM.
ALe
Help indigent families: www.bancomadreteresa.org
Great!I was a little confused by the need to use 'Call' and not execute the script directly. I have used execscript() sparingly for dynamic DHTML mostly because it lacks error handling.
I am still curious as to whether the jscript code is callable from within the page?
Stan
stanl, as you'll have noticed I'm not an expert of javascript/html.
So I see my solution works but I don't know actually what's the point.
ALe
Help indigent families: www.bancomadreteresa.org