标题: 请问为什么找不到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