yarao:你好,我的程序如下,在97上运行基本正常,多次(连续50以上)调用函数后会出现内存不够的现象,不知道什么原因,但在OFFICE2000中无法启动(PowerPoint.Application.9),能否看出什么BUGS?
Function Showsild(SildeName As String)
If CreatSilde > 1 Then
'当多次调用函数后会出现内存不够的现象,不知道什么原因,可删除进程。
Set ppobj = Nothing
Set ppPres = Nothing
Set ppobj = GetObject(, "PowerPoint.Application.8")
Set ppPres = ppobj.Presentations.Open(SildeName)
ppPres.SlideShowSettings.Run
Else
Set Obj = Nothing
Set Pres = Nothing
Dim xloop As Integer
On Error Resume Next
Set Obj = GetObject(, "PowerPoint.application.8")
If Err.Number Then
Set Obj = CreateObject("PowerPoint.Application.8")
Err.Clear
End If
On Error GoTo err_cmdOLEPowerPoint
Set Pres = Obj.Presentations.Add
Set Pres = Obj.Presentations.Open(SildeName)
Pres.SlideShowSettings.Run
我不知道你是不是用OLE Automation 我也没看过你的程序,不过你好像些错了。
应该是这样的
Dim oPowerPoint as Object '定义为一个公有变量
sub Startup()
set oPowerPoint = CreateObject("PowerPoint.Application.9")
' 如果是office97 就是"PowerPoint.Application.8"
oPowerPoint.Visible = True '使你启动的自动化服务器可视
'.................
'你就可一通过oPowerPoint来操作你启动的PowerPoint对象了
end sub