我觉得这听起来并不愚蠢,但之前有效。我不知道它为什么突然停止工作。我尝试退出 Excel 并重新运行代码。无论我试图打开什么工作簿,都会遇到同样的问题。代码如下:
Sub Check()
Dim myFile As Variant
Dim wb As Workbooks
myFile = Application.GetOpenFilename(Title:="Please Choose the Info File")
If myFile = False Then
End
End If
Set wb = Workbooks.Open(myFile) '<-- Getting "Run-time error '13': Type mismatch
End Sub
答案 0 :(得分:3)
变量定义不正确
更改
Dim wb As Workbooks
单数
Dim wb As Workbook