如何关闭POWERPOINT 求助,急~!

humourHM 2006-06-08 11:52:37
通过下面代码打开PPT后。
ppt = (PowerPoint.Presentation) System.Runtime.InteropServices.Marshal.BindToMoniker(PPTfilename);
string sFile = PPTfilename.Substring(PPTfilename.LastIndexOf("\\")+1);
ppt.Application.Visible = Office.MsoTriState.msoCTrue;

UCOMIConnectionPointContainer oConnPointContainer = (UCOMIConnectionPointContainer) ppt.Application;
// Get the GUID of the EApplication interface.
Guid guid=typeof(PowerPoint.EApplication).GUID;
// Find the connection point.
oConnPointContainer.FindConnectionPoint(ref guid,out m_oConnectionPoint);
// Call Advise to sink up the connection.
m_oConnectionPoint.Advise(this,out m_Cookie);
为什么叉掉POWERPOINT窗口后,总是无法关闭(进程中依然存在)。
[DispId(2004)]//处理关闭事件
public void PresentationClose(PowerPoint.Presentation Pres)
{
object missing = System.Reflection.Missing.Value;
ppt.SaveAs(PPTfilename,PowerPoint.PpSaveAsFileType.ppSaveAsPresentation,Office.MsoTriState.msoCTrue);
ppt.Close();
m_oConnectionPoint.Unadvise(m_Cookie);
System.Runtime.InteropServices.Marshal.ReleaseComObject(ppt);
GC.Collect();
ppt = null;
}
...全文
342 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
fx_guo 2006-06-11
  • 打赏
  • 举报
回复
用个quit的函数,或许可以
humourHM 2006-06-09
  • 打赏
  • 举报
回复
顶~~,帮帮忙啊
这里怎么没人气啊。
大牛门,星星门在哪晃啊。能不能晃过来帮帮我啊
humourHM 2006-06-09
  • 打赏
  • 举报
回复
谁鼎一下,让我结贴算了

5,139

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 Office开发/ VBA
社区管理员
  • Office开发/ VBA社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧