2017-10-30 25 views
0

私はVBA Excelのスクリプトを経由してWebページ上のボタンをクリックしようとしているが、以下のコードを使用しているとき、私はランタイムエラーを取得しています:JavaScript VBAでJavaScript onClickイベントを有効にするには?

objIE.document.getElementById("e-actions-commonmasthead-mail").Click 

Iから取得しようとしている要素ページは次のHTMLで表示されます:

<td id="e-actions-commonmasthead-mail" 
    class="s-cell-center s-toolbarcell-left s-toolbar-text s-toolbarcell-selected" 
    title="Mail" toolbarside="left" toolbarindex="0" 
    com_ibm_dwa_ui_toolbar_overflowed="false" 

onmouseover="AAA.DSq.EKc.prototype.EYl['e-actions-commonmasthead:Ebx'].EEu(event, this);" 
    onmouseout="AAA.DSq.EKc.prototype.EYl['e-actions-commonmasthead:Ebx'].EEu(event, this);" 
    onclick="AAA.DSq.ELU(event, 'e-actions-commonmasthead', 'Gqj', {area:'mail'});" 

    unselectable="on" style="-moz-box-sizing:border-box;-webkit-user-select:none;"> 

<img align="center" border="0" width="16" height="16" 
    id="e-actions-commonmasthead-mail-icon" 
    class="s-toolbaricon-notext" 
    src="/iNotes/Forms9.nsf/transparent.gif?OpenFileResource&amp;MX&amp;TS=20160816T154745,21Z" 
    xoffset="" yoffset="" 
    style="background-image: url(&quot;/iNotes/Forms9.nsf/sprite_masthead.png?OpenFileResource&amp;MX&amp;TS=20160816T154745,21Z&quot;); 
      background-position: -17px 0px;"> 
</td> 

クリックとFireEvent "onclick"の両方を試しましたが、実行時エラーが発生します。

+0

どのようなエラーが発生していますか? –

+0

実行時エラー '424'、オブジェクトが必要です。 –

+0

投稿したコード行の各オブジェクトをチェックして、どちらが「Nothing」であるかを確認します。もう少しコードを投稿すると便利です。 –

答えて

1

私はそれを理解しました。私はコードの下を経由して、手動でonclickのスクリプトを呼び出す必要があります:すべてのヘルプやヒントについて

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

感謝を!

関連する問題