如图,我要选择.xsl格式文件,如果不是应该提示文件格式不正确,要怎么该以下代码
Private Sub Dir1_Change()
File1.Pattern = ("*.xls")
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End SubPrivate Sub File1_Click()
Text1.Text = "" & Dir1.List(-1) & "\" & File1.FileName
End Sub
=>
if not File1.FileName Like "*.xls" then
MsgBox "不正确"
else
Text1.Text = "" & Dir1.List(-1) & "\" & File1.FileName
end if
File1.Pattern = ("*.xls;*.xlsx")
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End SubPrivate Sub File1_Click()
If Not File1.FileName Like "*.xls" Or File1.FileName Like "*.xlsx" Then
MsgBox "不正确"
Else
Text1.Text = "" & Dir1.List(-1) & "\" & File1.FileName
End If
End Sub如果两种呢,怎么改