COMException未处理Visual Basic 2010错误

时间:2013-03-12 20:04:51

标签: vb.net visual-studio

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

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未处理RPC服务器不可用。来自HRESULT的异常:0X800706BA

0 个答案:

没有答案