Showing posts with label Automate Powerpoint. Show all posts
Showing posts with label Automate Powerpoint. Show all posts

Sunday, May 26, 2013

Convert PowerPoint TextBox Slides as Notes using VBA

How to Add Notes to Powerpoint Slides using VBA


It has been quite some time since I posted in this blog. Murugan had kindled that in the form of the following snippet. We are had earlier tried Creating PowerPoint Presentation through VBA and Save PowerPoint Presentation as PDF using VBA

This snippet converts the TextBoxes / Shapes with Text that are available in PowerPoint Slide to Notes Section.

Sub Export_TextBoxes_AsNotes()
    
    Dim oPPT As Presentation
    Dim oSlide As Slide
    Dim oSlideShape As Shape
    Dim oNotesShape As Shape
    
    Set oPPT = ActivePresentation
    Set oSlide = oPPT.Slides(3)
    
    For Each oSlideShape In oSlide.Shapes
        
        If oSlideShape.HasTextFrame Then
        
            Set oNotesShape = oSlide.NotesPage.Shapes.AddShape(msoShapeRectangle, 54, 442, 432, 324) '
            oNotesShape.TextFrame.TextRange.Text = oSlideShape.TextFrame.TextRange.Text
        
        End If
    
    Next
    
    If Not oSlide Is Nothing Then Set oSlide = Nothing
    If Not oPPT Is Nothing Then Set oPPT = Nothing
    

End Sub



See also:
Delete End Points from List using Powerpoint VBA
How to Save PowerPoint Presentation as PDF using VBA

Saturday, July 08, 2006

VBA - Creating PowerPoint Presentation

Most often we will come across a scenario where powerpoint slides need to be created automatically.

Here is a sample & simple code to do that. This code is created using VBA (Excel 2000)

Sub Create_PowerPoint_Slides()

On Error GoTo Err_PPT

Dim oPA As PowerPoint.Application
Dim oPP As PowerPoint.Presentation
Dim oPS As PowerPoint.Slide
Dim oShape As PowerPoint.Shape
Dim sPath As String
Dim sFile As String
Dim i1 As Integer


sPath = "C:\"
sFile = "MyfileName"

Set oPA = New PowerPoint.Application
oPA.Visible = msoTrue

Set oPP = oPA.Presentations.Add(msoTrue)

For i1 = 1 To 10
oPP.Slides.Add 1, ppLayoutBlank
Next i1

Set oPS = oPP.Slides(1)
Set oShape = oPS.Shapes.AddTextbox(msoTextOrientationHorizontal, 140#, 246#, 400#, 36#)
oShape.TextFrame.WordWrap = msoTrue

oShape.TextFrame.TextRange.Text = "Comments For File : " & sFile
With oShape
.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.RGB = RGB(204, 255, 255)
.Line.Weight = 3#
.Line.Visible = msoTrue
.Line.ForeColor.SchemeColor = ppForeground
.Line.BackColor.RGB = RGB(255, 255, 255)
End With


oPP.SaveAs sPath & sFile & ".ppt"
oPP.Close
oPA.Quit

If Not oPS Is Nothing Then Set oPS = Nothing
If Not oPP Is Nothing Then Set oPP = Nothing
If Not oPA Is Nothing Then Set oPA = Nothing



Err_PPT:
If Err <> 0 Then
MsgBox Err.Description
Err.Clear
Resume Next
End If

End Sub
Related Posts Plugin for WordPress, Blogger...
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.