Open Powerpoint from Excel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TKrc
    New Member
    • Sep 2006
    • 3

    Open Powerpoint from Excel

    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:\Progr am Files\Microsoft Office\OFFICE11 \POWERPNT.EXE ""

    Can anyone please point me in the right direction.

    Thank you so much
  • milkyman
    New Member
    • Aug 2006
    • 12

    #2
    Originally posted by TKrc
    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:\Progr am 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(wi th PowerPoint)


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

    Private Sub Command1_Click( )
    ' Start PowerPoint.
    Dim ppApp As PowerPoint.Appl ication
    Set ppApp = CreateObject("P owerpoint.Appli cation")

    ' Maak de toepassing zichtbaar.
    ppApp.Visible = True

    ' Voeg een nieuwe presentatie toe.
    Dim ppPres As PowerPoint.Pres entation
    'Set ppPres = ppApp.Presentat ions.Add(msoTru e)
    ' Voeg een nieuwe dia toe.
    Dim ppSlide1 As PowerPoint.Slid e
    Set ppSlide1 = ppPres.Slides.A dd(1, ppLayoutText)

    ' Voeg wat tekst toe.
    ppSlide1.Shapes (1).TextFrame.T extRange.Text = "Mijn eerste dia"
    ppSlide1.Shapes (2).TextFrame.T extRange.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.Slid e
    Set ppSlide2 = ppPres.Slides.A dd(2, ppLayoutTextAnd Chart)

    ' Voeg wat tekst toe.
    ppSlide2.Shapes (1).TextFrame.T extRange.Text = "Slide 2's topic"
    ppSlide2.Shapes (2).TextFrame.T extRange.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.Ch art"

    ' Voeg nog een dia toe, met een organigram.
    Dim ppSlide3 As PowerPoint.Slid e
    Set ppSlide3 = ppPres.Slides.A dd(3, ppLayoutOrgchar t)

    ' Voeg wat tekst toe.

    ppSlide3.Shapes (1).TextFrame.T extRange.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, "OrgPlusWOP X.4" 'OrgPlusWOPX.4
    ' is een object van Microsoft Organigram


    ' Stel eigenschappen van de diavoorstelling in.
    With ppPres.Slides.R ange.SlideShowT ransition
    .EntryEffect = ppEffectRandom
    .AdvanceOnTime = msoTrue
    .AdvanceTime = 5 ' 5 seconds per slide
    End With

    ' Bereid de diavoorstelling voor en voer deze uit.
    With ppPres.SlideSho wSettings
    .ShowType = ppShowTypeKiosk
    .LoopUntilStopp ed = msoTrue

    .RangeType = ppShowAll
    .AdvanceMode = ppSlideShowUseS lideTimings
    .Run
    End With

    ' Slaapstand inschakelen, zodat gebruiker diavoorstelling kan bekijken.
    Sleep (15000)

    ' Opschonen.
    ppApp.Quit

    End Sub

    Comment

    • TKrc
      New Member
      • Sep 2006
      • 3

      #3
      Thank you so much for your reply. Not sure if it is exactly what i'm looking for.

      What I'm trying to do is open a specific powerpoint file from an option button, then close the powerpoint file and have my CustomMenu reappear. My CustomMenu would be the toolbox and i want to be able to pull either excel or powerpoint files up, make revisions, save and close. After closing any file, i want the CustomMenu to reappear. I have the excel files working properly, but having a little trouble with both Powerpoint and email.

      Any other suggestions would be much appreciated.

      thanks again

      Comment

      Working...