私の問題についてはstackoverflowに関する多くのトピックが見つかりましたが、残念ながら特定のウェブサイトの解決策を見つけることができませんでした。VBAプログラミング - ウェブサイト上のjavascriptリンクをクリック
私は銀行のウェブサイトからレポートを自動的に生成するようVBAを試行しています。 私はウェブサイトにアクセスし、ユーザーIDとパスワードを問題なくプラグインできました。私は通常、レポートを生成できるページに達しました。 リンクのクリックをシミュレートする必要があります...しかし、私はそれを行うことはできません。
は、私が上をクリックする必要があるリンクのHTMLコードです:
<a id="irCustomStepOne:headerDataTableId:23:reportnamestatus" href="#" style="float:left;" title="Summary Report Copy" onclick="jsf.util.chain(this,event,'if(isDateValidForMassPayPD()==\'false\' & isWareHouseRptPD(\'23\') ==\'true\'){RichFaces.$(\'irCustomStepOne:panelWareHouseRptError\').show(event, {\'top\':\'100px\', \'left\':\'300px\'});return false;}else{if(!onReportLink(\'23\')) return false;}','mojarra.jsfcljs(document.getElementById(\'irCustomStepOne\'),{\'irCustomStepOne:headerDataTableId:23:reportnamestatus\':\'irCustomStepOne:headerDataTableId:23:reportnamestatus\',\'repId\':\'3368127\',\'dayTypeKey\':\'PREVIOUS_DAY\',\'userAction\':\'Run\'},\'_blank\')');return false" class="">Summary Report Copy</a>
私はVBAのコード行を試してみたが、動作しません:
IE.Document .getElementById( "irCustomStepOne:headerDataTableId:23:reportnamestatusは")。FireEvent "onclickの"
誰もが、この "要約報告書のコピー" にVBAのおかげをクリックする方法任意のアイデアを持っていますか?
ありがとうございます!
EDIT:リンクがあるWebページの部分の完全なHTMLコードです。たぶん私は正しいIDを使用していないでしょうか?
<td width="290px">
<span id="irCustomStepOne:headerDataTableId:23:reportNmGrp">
<a id="irCustomStepOne:headerDataTableId:23:reportnamestatus" href="#" style="float:left;" title="Summary Report Copy" onclick="jsf.util.chain(this,event,'if(isDateValidForMassPayPD()==\'false\' & isWareHouseRptPD(\'23\') ==\'true\'){RichFaces.$(\'irCustomStepOne:panelWareHouseRptError\').show(event, {\'top\':\'100px\', \'left\':\'300px\'});return false;}else{if(!onReportLink(\'23\')) return false;}','mojarra.jsfcljs(document.getElementById(\'irCustomStepOne\'),{\'irCustomStepOne:headerDataTableId:23:reportnamestatus\':\'irCustomStepOne:headerDataTableId:23:reportnamestatus\',\'repId\':\'3368127\',\'dayTypeKey\':\'PREVIOUS_DAY\',\'userAction\':\'Run\'},\'_blank\')');return false">Summary Report Copy</a>
<a id="irCustomStepOne:headerDataTableId:23:reportnamePrint" href="#" style="float:left;display:none;" title="Summary Report Copy" onclick="jsf.util.chain(this,event,'if (!onReportLink(\'23\')) return false;','mojarra.jsfcljs(document.getElementById(\'irCustomStepOne\'),{\'irCustomStepOne:headerDataTableId:23:reportnamePrint\':\'irCustomStepOne:headerDataTableId:23:reportnamePrint\',\'repId\':\'3368127\',\'dayTypeKey\':\'PREVIOUS_DAY\',\'userAction\':\'Print\'},\'_blank\')');return false">Summary Report Copy</a>
<span id="irCustomStepOne:headerDataTableId:23:rpId" style="float:left;display:none;">3368127</span>
</span>
</td>
あなたは 'IE.Document.getElementByIdを試してみました。click'? –
はい、試しましたが、取得しました: 実行時エラー '424' オブジェクトが必要です これはリンクのIDなのでわかりません... – Cyriaque
ナビゲーションに数秒待ってからドキュメントが完全に読み込まれていないように見えます。これをリンクの上に追加してください: 'Application.Wait(Now + TimeValue(" 0:00:08 "))' –