I am trying to paste a figure that I have copied in my clipboard onto a slide within a for loop and I keep erroring out. Here is my code:
for i=1:20 fh=fig %code code code
%plot
print(gcf,'-dmeta'); %copy figure to clipboard
%create powerpoint and new slide
ppt = actxserver('PowerPoint.Application'); ppt.Visible = 1; ppt.Presentations.Add() layout = ppt.ActivePresentation.SlideMaster.CustomLayouts.Item(2); ppt.ActivePresentation.Slides.AddSlide(1, layout); %paste?
ppt.selection.PasteSpecial(0,0,1,0,3) %error, not valid
end
Best Answer