我不明白为什么这不起作用
xSource = vrtSelectedItem '<<== C:\Users\Me\Desktop\Document01.pdf
Set FSO = VBA.CreateObject("Scripting.FileSystemObject")
If Not InStr(xSource, ".jpg") Or Not InStr(xSource, ".bmp") Or Not InStr(xSource, ".png") _
Or Not InStr(xSource, ".tif") Or Not InStr(xSource, ".tga") Or Not InStr(xSource, ".jpeg") _
Or Not InStr(xSource, ".doc") Or Not InStr(xSource, ".pdf") Or Not InStr(xSource, ".rtf") _
Or Not InStr(xSource, ".htm") Or Not InStr(xSource, ".html") Or Not InStr(xSource, ".txt") _
Or Not InStr(xSource, ".docx") Or Not InStr(xSource, ".tdm") Or Not InStr(xSource, ".wri") _
Or Not InStr(xSource, ".xls") Or Not InStr(xSource, ".xlsx") Or Not InStr(xSource, ".xlsm") _
Or Not InStr(xSource, ".ods") Or Not InStr(xSource, ".odt") Then
MsgBox "File type not allowed"
Exit Sub
Else
.....
虽然文件包含.pdf,但我得到 MsgBox "File type not allowed"!我列出的所有其他文件类型也会发生这种情况,实际上将它们从错误消息中排除!谁能给我一些建议?谢谢