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
Thursday, August 7, 2008
VBA - Creating PowerPoint Presentation
Posted by Ayush Jain
Labels: Add Slides VBA, Add Text Box to Slide, Automate Powerpoint, Automate TextBox, Create Slides using VBA, Creating Presentation using VBA, Download, Powerpoint VBA, VBA Saving Powerpoint
Sunday, June 22, 2008
MCA Percentage Calculator (IP University)
.
Click here to Calculate your Cumulative Percentage
(Only for IP University MCA Students)
*Note : Please download the VBA tool and fill the boxes with your marks to calculate your final cumulative percentage.
.
Click here to Calculate your Cumulative Percentage
(Only for IP University MCA Students)
*Note : Please download the VBA tool and fill the boxes with your marks to calculate your final cumulative percentage.
.
Posted by Ayush Jain
Subscribe to:
Posts (Atom)