コードを実行すると、次のエラー メッセージが表示されます。
Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click
'Determine Text Inpu'
Dim IEApp As SHDocVw.InternetExplorer
Dim IEDoc As Object
Dim PREURL As String
Dim LocalFileName As String
Dim errcode As Long
IEApp = CreateObject("InternetExplorer.Application")
With IEApp
.Visible = False
.Navigate("http://mfreport.paho.org/barr/Default.asp")
Do While .Busy : Application.DoEvents() : Loop
Do **While .ReadyState <> 4** : Application.DoEvents() : Loop
With .Document.Forms("RptForm")
.JobName.Value = job.Text
.UsrName.Value = user.Text
.JobDate.Value = dtp.Text
.Submit()
.Action.click()
End With
Do While Not CBool(InStr(1, .Document.url, "mfreport.paho.org/barr/Default.asp"))
Application.DoEvents()
Loop
Do While .Busy : Application.DoEvents() : Loop
Do While .ReadyState <> 3 : Application.DoEvents() : Loop
End With
IEDoc = IEApp.Document
For i = 0 To IEDoc.Links.Length - 1
Dim sFullImageURL As String = "http://mfreport.paho.org/barr/JobReceived/" & IEDoc.Links(i).nameProp
Dim sLocalFileName As String = "I:\SYS_Systems\Support\Test\" & IEDoc.Links(i).nameProp
Dim MyWebClient As New WebClient
Call MyWebClient.DownloadFile(sFullImageURL, sLocalFileName)
Next i
If errcode = 0 Then
MsgBox("Download has Completed")
Else
MsgBox("An error has occurred")
End If
IEApp = Nothing
End Sub
これをdebbugで実行すると、次のエラーメッセージが表示されます COMException was unhandled the RPC server is available. HRESULT からの例外: 0X800706BA