What function in VB.NET simply takes a string parameter and runs a command? It would work just like the OK button in the Start -> Run dialog.
Dim myCommand as String
myCommand = "excel C:\Documents and Settings\JohnDoe\Desktop\test.xls"
Run(myCommand)
尝试这个:
System.Diagnostics.Process.Start(myCommand)
请参阅Shell
方法
May be try next:
Dim excel As Microsoft.Office.Interop.Excel.Application
Dim wb As Microsoft.Office.Interop.Excel.Workbook
excel = New Microsoft.Office.Interop.Excel.Application
wb = excel.Workbooks.Open("C:\Documents and Settings\JohnDoe\Desktop\test.xls")
excel.Visible = True
wb.Activate()
It will open Excel and selected document
Do this:
Shell("excel C:\Documents and Settings\JohnDoe\Desktop\test.xls")
Saves you 2 other lines of code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.