Export Microsoft PowerPoint slides to Microsoft Word using VBA

Abstract

This article explains, how to export all slides from a Microsoft PowerPoint presentation to Microsoft Word using Visual Basic for Applications (VBA).

Motivation

This feature was not found in the nomal user interface of neither Word nor PowerPoint. It is possible to cut/paste slides and to embed slides - or to export (e.g. as png) slides that can be added to a word document, but cannot (?) be formatted within Word all at once - only when a VBA procedure is applied (cf. below). The quality is much better, when using the Export as images, import and size these "inlineshapes".

Code for PowerPoint

001

002

003

004

005

006

007

008

009

010

011

012

013

014

015

016

017

018

019

020

021

022

023

024

025

026

027 

Option Explicit

 

' needs reference to Microsoft Word 14.0 Object Library

' or use late binding CreateObject("Word.Application")

Sub SlidesToWord()

   

    Dim wd As New Word.Application

    Dim wdoc As Word.Document

    Dim s As Slide

   

    wd.Visible = True

    Set wdoc = wd.Documents.Add

   

    For Each s In ActivePresentation.Slides

        s.Copy

        wd.Selection.Paste

    Next

   

    Dim o As Word.InlineShape

    For Each o In wdoc.InlineShapes

        'o.Width = 450

    Next

   

    Set wd = Nothing

    Set wdoc = Nothing

   

End Sub

Code for Word

001

002

003

004

005

006

007

008

009

Sub FormatAllShapes()

   

    Dim il As InlineShape

   

    For Each il In Selection.InlineShapes

        il.Width = 450

    Next

   

End Sub

Open Questions

Is there a way to size several objects in Microsoft Word without code?


Dieter Neumann