I am using Excel 2007 to create a Powerpoint presentation via early binding. I would like to convert the code to late binding since I want people to be able to use other versions of Office (e.g., 2010).
Can someone tell me what changes are needed to accomplish this?
Here's a snippet of my code:
When I change the first three lines to:
I get an error message on this line, stating that the "ppLayoutText" variable is not defined.
Can someone tell me the enumeration value for ppLayoutText (as well as the other early binding layout types)?
Can someone tell me what changes are needed to accomplish this?
Here's a snippet of my code:
Code:
Private Sub Build_Powerpoint_Presentation_Button_Click()
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim Path As String
Dim Slide_Number as Byte
Path = ThisWorkbook.Path
On Error Resume Next
Set PPApp = GetObject(, "Powerpoint.Application")
If PPApp Is Nothing Then 'Could not get instance, so create a new one
Set PPApp = CreateObject("Powerpoint.Application")
PPApp.Visible = True
Slide_Number = 1
Set PPPres = PPApp.Presentations.Open(Path & "\Presentation Template.potx")
With PPApp.ActivePresentation.Slides(Slide_Number)
.shapes(1).TextFrame.TextRange.Text = "Inventory Report"
.shapes(2).TextFrame.TextRange.Text = "July 2011"
End With
Slide_Number = Slide_Number + 1
With PPApp.ActivePresentation.Slides.Add(Slide_Number, ppLayoutText)
.shapes(1).TextFrame.TextRange.Font.Size = 28
.shapes(1).TextFrame.TextRange.Text = "Location Information:"
.shapes(1).TextFrame.AutoSize = ppAutoSizeShapeToFitText
.shapes(1).Top = 50
.shapes(2).TextFrame.TextRange.Font.Size = 14
.shapes(2).TextFrame.TextRange.Text = Location_Information_Bullets
.shapes(2).Top = 85
.shapes(2).Height = 400
.shapes(2).TextFrame.AutoSize = ppAutoSizeShapeToFitText
End With
End If
MsgBox ("Your presentation has been generated in the background. Please switch over to Microsoft PowerPoint to view the presentation."), vbOKOnly + vbInformation, "Report Complete:"
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
End Sub
Code:
Dim PPApp As Object
Dim PPPres As Object
Dim PPSlide As Object
Code:
With PPApp.ActivePresentation.Slides.Add(Slide_Number, ppLayoutText)
Can someone tell me the enumeration value for ppLayoutText (as well as the other early binding layout types)?