Visual Basic 6.0 SP5, Windows 2000 Pro SP2, Power Point 2000
I designed a PPT file just with one slide, to use it as a template.
I open this presentation from VB, add it more slides and change de text frames in them; and save the presentation with another file name.
But just the last added slide in the presentation preserve the text modified by my prog. All before has this text frames blank!
I trayed to add the textboxes as new objects and the result is the same.Code:Dim PPObj As PowerPoint.Application Dim PPT As PowerPoint.Presentation 'startup a Power Point instance in background Set PPObj = New PowerPoint.Application 'Open the presentation to use it as a template 'this presentation already has several text frame PPObj.Presentations.Open FileName:=App.Path & "\SPS-Obras.ppt", _ ReadOnly:=False, Untitled:=True, WithWindow:=False 'Set the presentation to an object Set PPT = PPObj.Presentations.Item(1) 'Call the procedure which open the database Call OpenFoxDBC 'get data SQL = "SELECT proy FROM cont2mil2 ORDER BY proy" 'open the recordset If OpenRecordset(SQL, rsProg, CnFox) > 0 Then For i = 1 To rsProg.RecordCount rsProg.AbsolutePosition = i With PPT.Slides.Item(PPT.Slides.Count) .Shapes.Item(1).TextFrame.TextRange.Text = rsProg!Field1 .Shapes.Item(2).TextFrame.TextRange.Text = rsProg!Field2 End With 'Add a new slide PPT.Slides.Add 1, ppLayoutBlank Next End If 'Save teh presentation with another name PPT.SaveAs App.Path & "\MyNameFile"
Any idea about how to solve this problem?




Reply With Quote