Skip to content

Instantly share code, notes, and snippets.

@quonic
Created January 22, 2019 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quonic/94d67bb83925d2d9a40c17daed5fc9c4 to your computer and use it in GitHub Desktop.
Save quonic/94d67bb83925d2d9a40c17daed5fc9c4 to your computer and use it in GitHub Desktop.
Sample of how to create a PowePoint slide and get the text of a shape
$Application = New-Object -ComObject PowerPoint.Application
# Make PowerPoint visible during debug
$Application.Visible = [Microsoft.Office.Core.MsoTriState]::msoTrue
# Create a new presentation
$Application.Presentations.Add([Microsoft.Office.Core.MsoTriState]::msoTrue)
# Add a slide
# Yes... index starts at 1...
$Application.Presentations[1].Slides.Add(1,1)
# Get the text of the first shape in the first slide
$Application.Presentations[1].Slides[1].Shapes[1].TextFrame2.TextRange.Text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment