フィルターのクリア

Is it possible to call Excel Macro Functions from MATLAB?

23 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
I would like to call Excel Macro Functions from MATLAB.

採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
You can execute Excel Macro functions from the MATLAB environment by using the ActiveX interface.
Here are two simple examples on how to call a Sub (in VB/VBA: a procedure without any returned values) and a Function (returns a value):
excelObject = actxserver('Excel.Application');
excelObject.Workbooks.Open('C:\Test.xls');
excelObject.Run('TestSub', 'Hello world');
retValue = excelObject.Run('TestFnc', 'Hello world from a function');
The Excel Macro routines that belong to this example (Test.xls) should be in a module and look as follows:
Public Sub TestSub(arg1 As String)
MsgBox arg1
End Sub
Public Function TestFnc(arg1 As String)
TestFnc = "Passed: " & arg1
End Function

その他の回答 (0 件)

製品


リリース

R2007b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by