Friday, October 2, 2009

Set note pages slide image and notes image to standard size

This usually happen when you copy a bunch of slides from other presentation and incorporate it into your current presentation. and the result might be what you see below, page 1's slide image is smaller than page 2's slide image


Page 1

Page 2

To overcome this, i prepare the VBA script below. Not sure if there is a non-VBA method that can be used to solve this, but if yes, please let me know also.




Sub resize()
Dim x As Long
Dim y As Long
Dim i As Long
Dim arrayCount As Integer
Dim shapeNameArray() As String

' Loop through every presentation slide(s)
For x = 1 To ActivePresentation.Slides.Count

' Manipulate shapes in notespage view
With ActivePresentation.Slides(x).NotesPage

' Loop through every shapes in the notepage view slide
For y = 1 To .Shapes.Count

' To select the presentation slide
' Usually the presentation slide will be on top,
' so use top property to limit the selection
' the use of height property is optional
' the use of this is mainly to filter away shapes like
' header, footer and page number
' which might be in place, and usually those shapes' height will not
' be higher than 90, so i use this as the condition
' The reason i say is optional is because you can always go to
' Edit Header and Footer to take out
' all header, footer and page number
' and reapply them later
' 1 inchi= 72

If .Shapes(y).Top < 100 And .Shapes(y).Height > 90 Then
.Shapes(y).Height = 364.32
.Shapes(y).Width = 486
.Shapes(y).Top = 28.08
.Shapes(y).Left = 46.8

' To select the notes page
' Usually notes page will be be below presentation slide
' so use top property to limit the selection
' Again use of height is optional

ElseIf .Shapes(y).Height > 90 And .Shapes(y).Top > 100 Then
.Shapes(y).Height = 322.56
.Shapes(y).Width = 486
.Shapes(y).Top = 404.64
.Shapes(y).Left = 46.8
Else
' Do nothing
' or you want to apply something to the filtered shape here
End If

Next y
End With
Next x
End Sub


To use this code, you must first enable macro if you have not donw so and then open the VBA editor, follow this link to find out how to do it. Remember, always make a copy of your power point slide before you applying any changes to it. This code is only tested on PowerPoint 2007.

No comments: