Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“如何激活JavaScript”;onclick";通过Excel VBA的事件?_Javascript_Html_Vba - Fatal编程技术网

“如何激活JavaScript”;onclick";通过Excel VBA的事件?

“如何激活JavaScript”;onclick";通过Excel VBA的事件?,javascript,html,vba,Javascript,Html,Vba,我试图通过VBA excel脚本单击网页上的按钮,但使用以下代码时出现运行时错误: objIE.document.getElementById("e-actions-commonmasthead-mail").Click Call objIE.document.parentWindow.execScript("AAA.DSq.ELU(event, 'e-actions-commonmasthead', 'Gqj', {area:'mail'})", "JavaScript") 我试图

我试图通过VBA excel脚本单击网页上的按钮,但使用以下代码时出现运行时错误:

objIE.document.getElementById("e-actions-commonmasthead-mail").Click
 Call objIE.document.parentWindow.execScript("AAA.DSq.ELU(event, 'e-actions-commonmasthead', 'Gqj', {area:'mail'})", "JavaScript")   
我试图从页面中获取的元素与以下HTML一起列出:



我尝试了Click和FireEvent“onclick”,但它们都给了我运行时错误。

好的,我找到了答案。我需要通过以下代码手动调用onclick脚本:

objIE.document.getElementById("e-actions-commonmasthead-mail").Click
 Call objIE.document.parentWindow.execScript("AAA.DSq.ELU(event, 'e-actions-commonmasthead', 'Gqj', {area:'mail'})", "JavaScript")   

感谢所有的帮助和提示

您遇到了什么错误?我遇到了运行时错误“424”,需要对象。请检查您发布的代码行中的每个对象,以查看哪个对象是
Nothing
。多发布一些代码会很有用。