Error 91 when i only have a code line for open MATLAB from Visual Basic (VB) in Excel's Macros. What should I do?

This is the original code from the Example in MATLAB page, I put ' in all the lines but 2 (for create the variable and for open MATLAB). The error keeps appearing also with this 2 lines. What do I need to do?
Sub callMATLAB()
Dim MatLab As Object 'Dim Result As String
MatLab = CreateObject("Matlab.Desktop.Application")
'Calling MATLAB function from VB
'Assuming solve_bvp exists at specified location
'Result = MatLab.Execute("cd d:\matlab\work\bvp")
'Result = MatLab.Execute("solve_bvp")
'Executing other MATLAB commands
'Result = MatLab.Execute("surf(peaks)")
'Result = MatLab.Execute("a = [1 2 3 4; 5 6 7 8]")
'Result = MatLab.Execute("b = a + a ")
'Bring matrix b into VB program
'MatLab.GetFullMatrix("b", "base", MReal, MImag)
End Sub
TY ALL! ^_^

Answers (0)

Categories

Asked:

on 13 Sep 2017

Community Treasure Hunt

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

Start Hunting!