我無法解釋這個簡單代碼有什麼問題。它適用於Excel 2003,但在Excel 2010中顯示如下:在Excel 2010上編譯錯誤,但不在Excel 2003上編譯錯誤
Compile error: Sub of Function not defined.
任何人都可以解釋爲什麼Excel 2010中存在錯誤?
Sub Test_File_Opened()
If IsFileOpen("D:\Test.xls") Then
MsgBox "File is open!"
Else
MsgBox "File is closed!"
End If
End Sub
也發佈'IsFileOpen'函數。當您將代碼從2003年轉移到2010年時,應該包含它。 – L42 2015-03-31 07:19:57
此[鏈接](http://www.mrexcel.com/forum/excel-questions/778329-isfileopen.html)可能會爲您澄清。 'IsFileOpen'不是內置的VBA功能。 – rusk 2015-03-31 07:20:25
@rusk它不能解釋爲什麼UDF在xl 2003工作。MJ54,請張貼您的功能。 – brettdj 2015-03-31 07:40:39