Code covered by the BSD License  

Highlights from
Simulink to MS Powerpoint Easy Navigation

image thumbnail

Simulink to MS Powerpoint Easy Navigation

by

 

Open a Powerpoint document at a specific slide location by a double click in a Simulink Model

gotoSlide(document,index)
function gotoSlide(document,index)

% get the current running Word COM server or open a new one
try 
    hComServer = actxGetRunningServer('Powerpoint.Application');
catch err
    hComServer = actxserver('Powerpoint.Application');
end
hComServer.Visible = 1;

% get the absolute path name of the document
filepath = document;
if isempty(intersect(':',filepath))
    filepath = [pwd '\' filepath];
end

% check if the document is already open
isOpened = false;
for i=1:hComServer.Presentations.Count
    name = hComServer.Presentations.Item(i).Name;
    path = hComServer.Presentations.Item(i).Path;
    fullname = [path '\' name];
    if strcmp(filepath,fullname)
        isOpened = true;
    end
end

% otherwise open it
if ~isOpened
    try
        hComServer.Presentations.Open(filepath)	;
    catch err
        error(err.message);
    end
end

% go to the slide
try
    hComServer.Presentations.Item(filepath).Slides.Item(index).Select
    for i=1:10
        hComServer.Activate;
    end
catch err
    error(err.message);
end

end

Contact us