Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing PowerPoint through OLE container????

Status
Not open for further replies.

maltobji

Programmer
Feb 13, 2001
31
JO
dear all,
can any body help me in accessing the Powerpoint through an OLE container (how to show the next slide ,...insert a new defualt slide...etc)..
thanx in advance..

 
you can do it better with automations : set ref to Powerpoint 9.0 Object library

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Command1_Click()

Dim oPPT As PowerPoint.Application
Dim oPres As PowerPoint.Presentation
Dim oSlide As PowerPoint.Slide

'Create a new presentation in Powerpoint
Set oPPT = New PowerPoint.Application
Set oPres = oPPT.Presentations.Add(True)

'SLIDE #1
'Add a slide with a title
Set oSlide = oPres.Slides.Add(1, ppLayoutTitle)
oSlide.Shapes("Rectangle 2").TextFrame.TextRange.Text = _
"Demo met Powerpoint"
oSlide.Shapes("Rectangle 3").TextFrame.TextRange.Text = _
"Voorstelling van Analyse TimeSheet versie 3.04"

'SLIDE #2
'Add a slide with an MSGraph chart. Add data for the chart and
'format it with the Pie Chart style
Set oSlide = oPres.Slides.Add(2, ppLayoutBlank)
Dim oShape As PowerPoint.Shape
Set oShape = oSlide.Shapes.AddOLEObject(20, 20, 660, 500, _
"MSGraph.Chart")

Dim oGraph As Graph.Chart
Set oGraph = oShape.OLEFormat.Object
With oGraph.Application.DataSheet
.Cells.Delete
.Cells(1, 2).Value = "Eric De Decker": .Cells(2, 2).Value = 520
.Cells(1, 3).Value = "Clesters Anne": .Cells(2, 3).Value = 660
.Cells(1, 4).Value = "Wouters Koen": .Cells(2, 4).Value = 690
End With
oGraph.ChartType = xlPie
oGraph.HasTitle = True
oGraph.ChartTitle.Text = "Acme Corporation"
oGraph.PlotArea.Border.LineStyle = xlLineStyleNone
oGraph.Legend.Position = xlLegendPositionBottom
oGraph.Application.Update
oGraph.Application.Quit

'SLIDE #3
'Add another slide with Text Effects
Set oSlide = oPres.Slides.Add(3, ppLayoutBlank)
oSlide.Shapes.AddTextEffect 27, "Bedankt voor het kijken !", "Impact", _
100, False, False, 200, 200
'Note: msoTextEffect28 = 27

'Apply a color scheme to all slides and apply slideshow settings
'to all slides
With oPres.Slides.Range
.ColorScheme = oPres.ColorSchemes(3)
With .SlideShowTransition
.EntryEffect = ppEffectBlindsVertical
.AdvanceOnTime = True
.AdvanceTime = 3
End With
End With

'View the slide show
Sleep 500
With oPres.SlideShowSettings
.AdvanceMode = ppSlideShowUseSlideTimings
.Run
End With

'Wait until there are no more slide show windows and then quit
'Powerpoint
Do
Sleep 1000
Loop While oPPT.SlideShowWindows.Count > 0
oPPT.Quit

End Sub
Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top