当我尝试在Excel中运行时出现type mismatch
错误...
Dim wkb As Workbook
Dim wks As Worksheets
Set wkb = ThisWorkbook
Set wks = wkb.Worksheets(1)
当我在Access中执行相同的操作(包括Dim app as Application.Excel
)时,我没有任何问题。
我在看什么?
答案 0 :(得分:3)
类型不正确。您已定义"工作表"然后尝试分配一个"工作表"
更改:
Dim wks As Worksheets
到:
Dim wks As Worksheet
应该有用。