51Testing软件测试论坛

标题: 请问为什么找不到ppt文本输入框的text属性? [打印本页]

作者: xiaoyaoke    时间: 2007-10-30 13:52
标题: 请问为什么找不到ppt文本输入框的text属性?
如题,写了段代码,目的是新建一个ppt文档添加内容后保存到指定位置:
Function CreatePowerPoint(sFilePath,sFileContent) 'As PowerPoint Application
   Dim PowerPointApp,PowerPointPresentation,PowerPointSlide
   Set PowerPointApp = CreateObject("PowerPoint.Application") 'Create a new PowerPoint Object
   PowerPointApp.Visible = True  'Make it visible
   Set PowerPointPresentation =  PowerPointApp.Presentations.Add'Add the property of PowerPoint
            PowerPointPresentation.SaveAs(sFilePath)
   Set PowerPointSlide =PowerPointPresentation.Slides.Add(1,PowerPointPresentation.Slides.Count+1) '.Slides.Add(CurrentSlideNumber,TotalSlideNumber)
            PowerPointPresentation.Slides(1).Shapes.Item(1).TextFrame.TextRange.Select
   Set PowerPointPresentation.Slides(1).Shapes.Item(1).TextFrame.TextRange.text = sFileContent
   Set PowerPoint = Nothing
   Set PowerPointPresentation = Nothing
   Set PowerPointSlide = Nothing
End Function

Call CreatePowerPoint("c:\ppt.ppt","H")
可问题是运行到这句:Set PowerPointPresentation.Slides(1).Shapes.Item(1).TextFrame.TextRange.text = sFileContent
总说找不到TextFrame.TextRange.text对象
搞不懂是为什么了
知道的麻烦指点下,先谢谢了
作者: xiaoyaoke    时间: 2007-10-30 14:37
顶上去
大家帮忙想想办法,我也自己再看看




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2