Filter löschen
Filter löschen

Close Command after running MATLAB function in EXCEL VBA

4 Ansichten (letzte 30 Tage)
Surae
Surae am 19 Jul. 2011
Hi,
I'm finding a close command after running a M file in EXCEL VBA.
Because I got a alert message like "Microsoft Office Excel is waiting for another application to complete on OLE action" after running a M file in Excel VBA.
Do you have any idea about the close MATLAB application command in VBA?
Dim MatLab As Object
Dim Result As String
Set MatLab = CreateObject("MatLab.desktop.Application")
Result = MatLab.Execute("cd('C:\Documents and Settings\M02043\Desktop\MATLAB Interface Test')")
Result = MatLab.Execute("f_ann")
End Sub
Thanks a lot in advance.
  1 Kommentar
Kaustubha Govind
Kaustubha Govind am 19 Jul. 2011
Try
MatLab.Execute("quit")
I don't know if this will fix the error though.

Melden Sie sich an, um zu kommentieren.

Antworten (3)

Surae
Surae am 20 Jul. 2011
Hi,
I got an solution for this issue. Please have a look at following if anyone have a similar problem like me.
This alert message seems to occur from MS office itself due to using an external application and I could disregard the message as below.
Good luck.
Dim lDisplayAlerts as Boolean
lDisplayAlerts = Application.DisplayAlerts
Application.DisplayAlerts = False
.
.
.
.
Application.DisplayAlerts = lDisplayAlerts
  1 Kommentar
Chirag Gupta
Chirag Gupta am 20 Jul. 2011
Please accept your answer, so that it is easily available to others!

Melden Sie sich an, um zu kommentieren.


Chirag Gupta
Chirag Gupta am 19 Jul. 2011
Kaustubha's suggestion looks good to me. Is your routine f_ann finished when you try and exit?

Surae
Surae am 19 Jul. 2011
Hi,
I tried it with below Macro already but I still couldn't exit Matlab application without closing "Microsoft Excel Office Excel is waiting ... OLE action" message.
Result = MatLab.Execute("quit")
'exit' also doesn't work.
Is there anybody having a similar problem like me? Thanks,

Kategorien

Mehr zu Data Export to MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by