Adding file in Excel with ActiveX and OLEObject
Show older comments
Hello,
I have a question about Excel automation and OLEObject.
I have a code that generate a Excel report using ActiveX. My purpose is to insert a file (in my case .html) in a Excel worksheet so that the user can access it by cliking on the icon :

Here the code I tested (Matlab 2016b) :
e = actxserver('Excel.Application');
WB = e.Workbooks.Open(MyExcelFile);
eSheets = e.activeWorkbook.Sheets;
eSheetDatas = eSheets.get('Item', 1);
eSheetDatas.Activate
eSheetDatas.OLEObjects.Add([],MyHTMLFile,0,1,[],[],[],100,500,50,50); % For the options I want to fix a position, and show an icon
Close(WB)
Quit(e)
delete(e)
When I run this, Matlab get stuck like in infinite loop.
I think the syntax of the OLEObject.Add is not good for matlab.
Any help please ?
1 Comment
gdell0
on 20 Dec 2021
Answers (0)
Categories
Find more on ActiveX in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!