0

运行代码时收到以下错误消息;

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

在调试中运行此程序时,我收到以下错误消息 COMException is unhandled the RPC server is available。HRESULT 异常:0X800706BA

4

0 回答 0