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:
[VBA]Call IE.document.parentWindow.execScript("buttonMovimenti()", "JavaScript")[/VBA]
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.
If no item has focus or selected than I'm sent to an error page.
you know why?
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
.Document.GetElementsByTagName("TAG").Item(n).FireEvent("click()")
which would then run the jscript.
.02 Stan
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
[VBA]IE.document.all.Item
Call IE.document.parentWindow.execScript("buttonMovimenti()", "JavaScript")[/VBA]
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
Can javaScript create rich interactivity? Can JavaScript create a rich interactive site like animations that when rolled over play out, or an interactive object that can be drug around the screen like a type of video game of sorts? or is Javascript limited to just hover buttons and photo gallery's thing like that?