在VB.NEt Windows应用程序中浏览URL

问题描述:



我对VB知之甚少.我需要编写用于在单击链接按钮时导航URL的代码,以便导航的URL将包含Excel文件,并且该文件应在单击链接按钮时打开.

Hi,

I know very little about VB. I Need to code for navigating a URL on clicking link button such that navigated URL will contain an Excel file and that file should open on clicking the link button.

这是Windows应用程序(URL在这方面有点误导),请查看 System.Diagnostics.Process类 [ ^ ]
Assuming this is a windows application (and URL is a little misleading in that respect), look at the System.Diagnostics.Process class[^]
Process.Start("F:\Temp\MySpreadSheet.xls")


Private Sub OpenExcelFileForEditing(ByVal OutputPath As String)
    Dim excel As Microsoft.Office.Interop.Excel.Application
    Dim wb As Microsoft.Office.Interop.Excel.Workbook

    Try
        excel = New Microsoft.Office.Interop.Excel.Application
        wb = excel.Workbooks.Open(OutputPath)
        excel.Visible = True
        wb.Activate()
        txtPath.Text = OutputPath
    Catch ex As COMException
        MessageBox.Show("Error accessing Excel: " + ex.ToString())
    Catch ex As Exception
        MessageBox.Show("Error: " + ex.ToString())
    End Try
End Sub