fileName = filePath & "/temp.xls"
If Dir(fileName) <> "" Then '文件存在
Set Form1.Grid1.DataSource = obj.Read_Excel(fileName, sheetName)
Form1.Grid1.Refresh
以上代码执行后会导致temp.xls只能只读打开,不能删除修改等问题.
处理方法:加入一句Set Form1.Grid1.DataSource = nothing即可解决