在VB.NEt Windows应用程序中浏览URL [英] Navigate URL In VB.NEt Windows Application
本文介绍了在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
这篇关于在VB.NEt Windows应用程序中浏览URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文