Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\test.xls")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
app.Visible = True
Dim ps As System.Diagnostics.Process() = System.Diagnostics.Process.GetProcessesByName("excel")
For Each p As System.Diagnostics.Process In ps
If p.MainWindowTitle Like "*test*" Then
msgbox("test文件已经打开")
Return Nothing
End If
Next
Dim App1 As New MSExcel.Application
Dim Wb1 As MSExcel.WorkBook = App1.WorkBooks.Open("D:\test.xls")
Dim Ws1 As MSExcel.WorkSheet = Wb1.WorkSheets(1)
app1.Visible = True