Outlook Web Access で各電子メールを処理するスクリプトを作成中です。メッセージはテーブルに保存され、メッセージのタイトルをクリックして使用できます (以下を参照)。
<table><tr><td nowrap class="frst">carrie.stevens@u... </td>
<td nowrap class="sc frst"><h1><a href="#" onClick="onClkRdMsg(this, 'IPM.Note', 0, 0);">Message 1</a></h1> </td><td nowrap class="frst">1/11/2011 12:16 PM </td></tr>
<tr><td nowrap>Doodle </td><td nowrap class="sc"><h1><a href="#" onClick="onClkRdMsg(this, 'IPM.Note', 1, 0);">Message 2</a></h1> </td><td nowrap>1/11/2011 8:29 AM </td></tr>`
</table>
問題は、各メッセージを開くために使用される Java スクリプトが存在することです。
onClkRdMsg(this, 'IPM.Note', 0, 0)
onClkRdMsg(this, 'IPM.Note', 1, 0)
私が試したのは:
Dim HTMLDoc As HTMLDocument
Dim oBrowser As InternetExplorer
Sub Login_2_Website()
'The code requires references to the following:
'1 Microsoft Internet Controls
'2. Microsoft HTML Object Library
Dim oHTML_Element As IHTMLElement
On Error GoTo Err_Clear
Set oBrowser = New InternetExplorer
URL_fold = "mywebpage.com"
oBrowser.navigate URL_fold
oBrowser.Visible = True
Do
' Wait till the Browser is loaded
Loop Until oBrowser.readyState = READYSTATE_COMPLETE
HTMLDoc.parentWindow.execScript "onClkRdMsg(this, 'IPM.Note', 1, 0)"
Err_Clear:
If Err <> 0 Then
'Debug.Assert Err = 0
Err = 0
Err.Clear
Resume Next
End If
End Sub
しかし、うまくいきません。どちらもしません:
For Each oHTML_Element In HTMLDoc.getElementsByTagName("h1")
oHTML_Element.Click
Next
私は何を間違っていますか?私の試みがうまくいかないので、あなたの助けは非常に高く評価されます - Webページがロードされた後にJSコードがトリガーされません.
ありがとうございました。