Private Sub CmdOK_Click()
If TextPoNum.Text = "" Then
MsgBox "请输入你需要打开的EXCEL文件!"
Else
Dim oleExcel As Object
Dim PoNum As String
Dim a As String
Set oleExcel = CreateObject("Excel.Application")
a = Left(TextPoNum.Text, 5)
With oleExcel
With .Application.FileSearch
.NewSearch
.LookIn = "c:\新建文件夹\a&*"
.SearchSubFolders = True
.FileName = TextPoNum.Text & "*.xls"
If .Execute() > 0 Then
oleExcel.Visible = True
oleExcel.Workbooks.Open .FoundFiles(1)
Else
MsgBox "没有找到符合条件的文件."
End If
End With
End With
End If
这样为什么打不开