Why do I receive a "Compile error: Sub or Function not defined" error when calling Excel Link functions from an Excel VBA macro?
9 ビュー (過去 30 日間)
古いコメントを表示
When calling any of the exported Excel Link functions (MLGetMatrix, MLPutVar, etc.) in an Excel VBA macro, I receive the following VBA error:
"Compile error: Sub or Function not defined"
採用された回答
MathWorks Support Team
2012 年 10 月 22 日
This error occurs because in Excel VBA, a reference must be set to another application in order to use that application's objects. To set a reference in your VBA project to Excel Link, perform the following steps:
1. Open the Microsoft Visual Basic development environment associated with the version of Excel you are using. Typically, you can browse in Excel by going to the 'Developer' Tab and click on the 'Visual Basic' icon (possibly the first icon on the left). Otherwise, Alt + F11 is another shortcut to open this utility.
2. In the Microsoft Visual Basic development window's project browser, click on your project.
3. From the "Tools" menu, select "References"
4. Check the "Excllink" box and click "OK"
Note: If the "Excllink" box does not appear in the references, make sure that Excel Link is selected as an add-in to Excel.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Export to MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!