我目前正在使用activeX-server对象(在代码中命名为PP)来编写来自MATLAB的powerpoint演示文稿(pres)。最后,我结束了演讲。这会导致powerpoint关闭演示文稿,这令人惊讶,但却打开了一个powerpoint窗口。如果我关闭PP对象,那么当前打开的所有powerpoint,不仅是我写的那些,都会被关闭。问题是所有的powerpoint窗口都共享一个进程而PP.Quit()会杀死该进程。有没有办法在不中断powerpoint进程的情况下关闭一个特定的powerpoint窗口?
PP = actxserver('PowerPoint.Application');
do stuff
pres = PP.Presentations.Open(fileName);
pres.Close(); %<- Closes the presentation, but an empty powerpoint window is still open.
PP.Quit(); % <- That is the problem
答案 0 :(得分:1)
你可以试试这个:
PP.Quit;
PP.delete;
而不是:
pres.Close(); %<- Closes the presentation, but an empty powerpoint window is still open.
PP.Quit(); % <- That is the problem