Hi Everyone - I am running XP (VB 6.3) and am having a problem opening Powerpoint from an option button that is located in a Userform.
The code I'm trying worked with windows 2000, but not XP.
MyAppID = Shell("C:\Program Files\Microsoft Office\OFFICE11\POWERPNT.EXE ""
Can anyone please point me in the right direction.
Thank you so much
Hi TKrc,
I see you want to open PowerPoint with a shell command. Why don't you open it whitin VB. If you put this code behind your Button it will start and begins a presentation(with PowerPoint)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
' Start PowerPoint.
Dim ppApp As PowerPoint.Application
Set ppApp = CreateObject("Powerpoint.Application")
' Maak de toepassing zichtbaar.
ppApp.Visible = True
' Voeg een nieuwe presentatie toe.
Dim ppPres As PowerPoint.Presentation
'Set ppPres = ppApp.Presentations.Add(msoTrue)
' Voeg een nieuwe dia toe.
Dim ppSlide1 As PowerPoint.Slide
Set ppSlide1 = ppPres.Slides.Add(1, ppLayoutText)
' Voeg wat tekst toe.
ppSlide1.Shapes(1).TextFrame.TextRange.Text = "Mijn eerste dia"
ppSlide1.Shapes(2).TextFrame.TextRange.Text = "PowerPoint automatiseren is een makkie" & vbCr & "Werken met Visual Basic is cool!"
' Voeg nog een dia toe, met een diagram.
Dim ppSlide2 As PowerPoint.Slide
Set ppSlide2 = ppPres.Slides.Add(2, ppLayoutTextAndChart)
' Voeg wat tekst toe.
ppSlide2.Shapes(1).TextFrame.TextRange.Text = "Slide 2's topic"
ppSlide2.Shapes(2).TextFrame.TextRange.Text = "U kunt in uw PowerPoint-dia's diagrammen maken en gebruiken!"
' Voeg een diagram toe op dezelfde locatie als het vorige diagram.
Dim cTop As Double
Dim cWidth As Double
Dim cHeight As Double
Dim cLeft As Double
With ppSlide2.Shapes(3)
cTop = .Top
cWidth = .Width
cHeight = .Height
cLeft = .Left
.Delete
End With
ppSlide2.Shapes.AddOLEObject cLeft, cTop, cWidth, cHeight, "MSGraph.Chart"
' Voeg nog een dia toe, met een organigram.
Dim ppSlide3 As PowerPoint.Slide
Set ppSlide3 = ppPres.Slides.Add(3, ppLayoutOrgchart)
' Voeg wat tekst toe.
ppSlide3.Shapes(1).TextFrame.TextRange.Text = "De rest wordt alleen beperkt door uw verbeelding"
' Voeg een organigram toe op dezelfde locatie als het vorige organigram.
With ppSlide3.Shapes(2)
cTop = .Top
cWidth = .Width
cHeight = .Height
cLeft = .Left
.Delete
End With
' ppSlide3.Shapes.AddOLEObject cLeft, cTop, cWidth, cHeight, "OrgPlusWOPX.4" 'OrgPlusWOPX.4
' is een object van Microsoft Organigram
' Stel eigenschappen van de diavoorstelling in.
With ppPres.Slides.Range.SlideShowTransition
.EntryEffect = ppEffectRandom
.AdvanceOnTime = msoTrue
.AdvanceTime = 5 ' 5 seconds per slide
End With
' Bereid de diavoorstelling voor en voer deze uit.
With ppPres.SlideShowSettings
.ShowType = ppShowTypeKiosk
.LoopUntilStopped = msoTrue
.RangeType = ppShowAll
.AdvanceMode = ppSlideShowUseSlideTimings
.Run
End With
' Slaapstand inschakelen, zodat gebruiker diavoorstelling kan bekijken.
Sleep (15000)
' Opschonen.
ppApp.Quit
End Sub