使用MATLAB关闭Powerpoint窗口

问题描述:

我目前正在使用一个activeX-server对象(在代码中命名为PP)从MATLAB编写一个powerpoint演示文稿(pres)。最后,我关闭了演示文稿。这导致幻灯片关闭演示文稿,这是一个惊喜,但打开了一个幻灯片窗口。如果我关闭PP对象,那么所有当前打开的权限点,不仅是我写的,都关闭了。问题是所有的PPT窗口共享一个进程,并且PP.Quit()终止该进程。有没有什么办法可以关闭一个特定的PowerPoint窗口而不杀死Powerpoint进程?使用MATLAB关闭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 

你可以试试这个:而不是

PP.Quit; 
PP.delete; 

pres.Close(); %<- Closes the presentation, but an empty powerpoint window is still open. 
PP.Quit(); % <- That is the problem 
+0

感谢您的回答。问题是,我仍然会关闭所有打开的PPT窗口。退出杀死Powerpoint Singleton。你的回答对我不起作用。 – littleHue

+0

奇怪。我以与Microsoft Excel类似的方式使用它,并且它不关闭所有其他窗口。我还看到,您将开放函数分配给变量 – Romano

+0

PP = actxserver('PowerPoint.Application'); do stuff PP.Presentations.Open(fileName); PP.Quit; PP.delete; – Romano