Jump to content

Gast376

Abgemeldet
  • Gesamte Inhalte

    2
  • Registriert seit

  • Letzter Besuch

Beiträge erstellt von Gast376

  1. Hallo zusammen,

     

    ich bin neu im Powershell-Umfeld, aber habe schon eine kleine Aufgabe für mich gefunden... leider stecke ich auch schon fest.  :confused:

     

    Ziel:

    Ich möchte gerne alle Folien, außer einem gewissen Bereich (z.B. Folie 12-16), aus einer PowerPoint-Datei löschen.

     

    Mein Skript:

    Function DeleteNotNeededSlides {
        param (
            [string]$strFileName,
    		[int]$intNeededSlideFrom,
    		[int]$intNeededSlideTo
    	)
    	
        # Create PowerPoint object
        $comApplication = New-Object -ComObject Powerpoint.Application
        $comApplication.visible = [Microsoft.Office.Core.MsoTriState]::msoFalse
        
        # Open PowerPoint file
        $objPresentation = $comApplication.Presentations.Open($strFileName)
    		
        # Delete slides
        $intSlidesSum = $objPresentation.Slides.Count
    
        for($intI = $intSlidesSum; $intI -ge $intSlideTo +1; $intI --) {
            $objPresentation.Slides.($intI).Delete
        }
    
        # Save and close
        $objPresentation.Save
        $objPresentation.Close
        
        # Quit PowerPoint object
        $comApplication.Quit
        $comApplication = $null
    }

    Problem:

    Das Skript läuft durch, aber die Folien sind noch drin.

     

    Ausgabe:

    OverloadedDefinitions
    ----------------------------
    void Delete ()
    void Delete ()
    ...
    void Delete ()
    void Save ()
    void Close ()
    void Quit()
    void _Application.Quit()

     

    Hat jemand eine Idee oder eine Lösung damit ich weiter komme!?

     

     

    Danke,

    Christian

×
×
  • Neu erstellen...