程序运行出现类型不匹配错误,求指导。

Sub GetFile_1()

Dim fil As Variant

fil = Application.GetOpenFilename(MultiSelect:=True) '调用函数显示【打开】对话框,在打开对话框里选择文件,获取文件名

If fil = False Then

    Exit Sub

Else

    Range("A1").Value = fil

End If

End Sub
点击取消按钮,程序运行正常;多选文件后点击打开后,提示fil类型不匹配,求大神指导!谢谢

可以在程序开头加上一个
On error resume next
跳过去