Convert PowerPoint Presentation to Word Document (PowerShell)
Introduction
This PowerShell script sample illustrates how to convert PowerPoint presentations to Word documents. Additionally, script will maintain the original format, layout for presentation and reduce the output file size. Supported version is PowerPoint 2010.
Scenarios
Converting PowerPoint presentations to Word documents is a frequently asked question in many public forums.
Note
1. You must close running PowerPoint applications before you execute this script. This script will close all current PowerPoint applications.
2. The output Word document will use the file name of the input PPT file (powerpoint1.pptx will be saved as powerpoint1.docx) and will be saved at the location of the input PPT file. The output Word document will overwrite any existing Word document with
same name.
Script
Step 1: Click
Start, type
powershell in the search box on the Start Menu, right-click the
Windows PowerShell icon, and then click
Run Windows PowerShell as administrator. If the
User Account Control dialog box appears, confirm that the action it displays is what you want, and then click
Continue.

Step 2: Run the script in the Windows PowerShell Console, type the command:
Import-Module <Script Path> at the prompt.For example, type
Import-Module G:\Script\ConvertPowerPointToWordDocument.psm1
This is shown in the following figure.

Step 3: You can type the
command
Get-Help ConvertTo-OSCWord
to display the entire help file for this function, such as the syntax, parameters, or examples.

Step 4: Then you can type the command
ConvertTo-OSCWord –Path <path name>,
for example as below
Or you could specify an absolute path name.

Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.
PowerShell
Edit|Remove
powershell
#get all the slides
$Slides = $Presentation.Slides
$SlidesCount = $Presentation.Slides.Count
#get height and width of slides
$sldHeight = $Presentation.PageSetup.SlideHeight
$sldWidth = $Presentation.PageSetup.SlideWidth
#set default variable
$wdPaperCustom = 41
$intPageNumber = 1
$wdGoToNext = 2
$wdGoToPage = 1
#setup word document page size
$Word=$WordAPP.Documents.Add()
#set the word document size
$WordAPP.Selection.PageSetup.LeftMargin = 0
$WordAPP.Selection.PageSetup.RightMargin = 0
$WordAPP.Selection.PageSetup.TopMargin = 0
$WordAPP.Selection.PageSetup.BottomMargin = 0
$WordAPP.Selection.PageSetup.PaperSize = $wdPaperCustom
$WordAPP.Selection.PageSetup.PageWidth = $sldWidth
$WordAPP.Selection.PageSetup.PageHeight = $sldHeight
#get all the slides
$Slides = $Presentation.Slides
$SlidesCount = $Presentation.Slides.Count
#get height and width of slides
$sldHeight = $Presentation.PageSetup.SlideHeight
$sldWidth = $Presentation.PageSetup.SlideWidth
#set default variable
$wdPaperCustom = 41
$intPageNumber = 1
$wdGoToNext = 2
$wdGoToPage = 1
#setup word document page size
$Word=$WordAPP.Documents.Add()
#set the word document size
$WordAPP.Selection.PageSetup.LeftMargin = 0
$WordAPP.Selection.PageSetup.RightMargin = 0
$WordAPP.Selection.PageSetup.TopMargin = 0
$WordAPP.Selection.PageSetup.BottomMargin = 0
$WordAPP.Selection.PageSetup.PaperSize = $wdPaperCustom
$WordAPP.Selection.PageSetup.PageWidth = $sldWidth
$WordAPP.Selection.PageSetup.PageHeight = $sldHeight
Prerequisite
Windows PowerShell 2.0
PowerPoint 2010
Additional Resources