2016-11-15 208 views
0

我目前正在使用一個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 

回答

1

你可以試試這個:而不是

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