Exporting from Matlab to excel with macro.
Mostrar comentarios más antiguos
I have matrix which I have to add in excel file. Excel file looks like in picture. With StartLoft, than StartCurve, than matrix which needs to be added, than EndCurve, EndLoft, End.

In this excel I should have embedded macro file to just open excel after starting matlab code, and run macro, without adding it additionaly. Is this possible? Macro code for excel is attached.
4 comentarios
Guillaume
el 10 de Jul. de 2018
Is this any different from your previous question with the exact same title, which you've completely ignored?
Guillaume
el 10 de Jul. de 2018
In addition, the first lines of the text file you've attached has this:
COPYRIGHT DASSAULT SYSTEMES 2001
Have you got permission from the copyright holder to post the file here?
Matija Kosak
el 10 de Jul. de 2018
Matija Kosak
el 10 de Jul. de 2018
Respuesta aceptada
Más respuestas (1)
Sayyed Ahmad
el 10 de Jul. de 2018
you have to use activeX in matlab to start Excel
e = actxserver('excel.application');
e.visible=1;
%%new Woorkbook
eWorkbooks = get(e, 'Workbooks');
% neuWB=Add(eWorkbooks)
%%open a Workbook
neuWB=eWorkbooks.Open('YourExcelFile.xlsm');
Now you kann start your Macro in Excel
%%makro starten
e.ExecuteExcel4Macro(['!NameOfModule.NameOfSub(' INPUT_ValuesFromMatlabInExcel ')']);
%%save your work in excel
neuWB.Save();
neuWB.Saved = 1;
neuWB.Close;
%%excel clear and close
e.Quit;
e.delete
I hope that is what you need!
cheers Ahmad
2 comentarios
Guillaume
el 10 de Jul. de 2018
Note that this requires that the macro already exists in the workbook and that macros are enabled. In most recent versions of Excel, if you have the default security settings, unless the macro is signed, macros will be disabled.
I would not recommend lowering the security settings as macro viruses are still common.
Matija Kosak
el 10 de Jul. de 2018
Categorías
Más información sobre Data Import from MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!