Convert PowerPoint refrence to late binding in Access
- From: "biganthony via AccessMonster.com" <u31673@uwe>
- Date: Sat, 12 Apr 2008 10:12:45 GMT
Hi,
The following code below works with a Reference set to PowerPoint. Could
someone help me convert the folowing code to late binding? My attempt is
below the original code.
ORIGINAL CODE***************
Dim db As Database, rs As Recordset
Dim ppObj As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
'Open up a recordset on the Employees table.
Set db = CurrentDb
Set rs = db.OpenRecordset("Employees", dbOpenDynaset)
'Open up an instance of Powerpoint.
Set ppObj = New PowerPoint.Application
Set PPPres = ppObj.Presentations.Add
'Setup the set of slides and populate them with data from the employee
table.
With PPPres
While Not rs.EOF
With .Slides.Add(rs.AbsolutePosition + 1, ppLayoutText)
.Shapes(1).TextFrame.TextRange.Text = CStr(rs.Fields
("EmployeeCode").value)
.SlideShowTransition.EntryEffect = ppEffectBlank
With .Shapes(2).TextFrame.TextRange
.Text = "FTE = " & CStr(rs.Fields("EmployeeFirst").value)
& vbCrLf & _
"Allowance = " & TeachersAllowance & vbCrLf & _
"Teacher's Load = " & CStr(rs.Fields("EmployeeLast").
value) & vbCrLf & _
"Teaching Value = " & CStr(rs.Fields("EmployeeHours").
value) & vbCrLf & _
"Teaching Value = " & CStr(rs.Fields("EmployeePosition").
value) & vbCrLf & _
"Teaching Value = " & CStr(rs.Fields("EmployeeRate").
value)
.Characters.Font.Color.RGB = RGB(0, 0, 255)
.Characters.Font.Shadow = True
.Characters.Font.Size = 26
End With
.Shapes(1).TextFrame.TextRange.Characters.Font.Size = 30
End With
rs.MoveNext
Wend
End With
'run the show.
PPPres.SlideShowSettings.Run
********************************
This is my attempt. When I run it in the immediate window, I get an error
message saying "Object Required" (Error Number 424).
MY ATTEMPT ****************
Dim PPApp As Object
Dim PPPres As Object
Dim PPSlide As Object
Dim db As Database, rs As Recordset
'Open up a recordset on the Employees table.
Set db = CurrentDb
Set rs = db.OpenRecordset("Employees", dbOpenDynaset)
Set PPApp = CreateObject("Powerpoint.Application")
Set PPPres = PPApp.Presentations.Add
With PPPres
While Not rs.EOF
With pptPres.Slides
Set PPSlide = .Add(rs.AbsolutePosition + 1, ppLayoutText)
.Shapes(1).TextFrame.TextRange.Text = CStr(rs.Fields
("EmployeeCode").value)
.SlideShowTransition.EntryEffect = ppEffectBlank
With PPSlide
.Text = "FTE = " & CStr(rs.Fields("EmployeeFirst").value)
& vbCrLf & _
"Allowance = " & TeachersAllowance & vbCrLf & _
"Teacher's Load = " & CStr(rs.Fields("EmployeeLast").
value) & vbCrLf & _
"Teaching Value = " & CStr(rs.Fields("EmployeeHours").
value) & vbCrLf & _
"Teaching Value = " & CStr(rs.Fields("EmployeePosition").
value) & vbCrLf & _
"Teaching Value = " & CStr(rs.Fields("EmployeeRate").
value)
.Characters.Font.Color.RGB = RGB(0, 0, 255)
.Characters.Font.Shadow = True
.Characters.Font.Size = 26
End With
.Shapes(1).TextFrame.TextRange.Characters.Font.Size = 30
End With
rs.MoveNext
Wend
End With
'run the show.
PPPres.SlideShowSettings.Run
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
I would appreciate any help.
Thanks
Anthony
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/200804/1
.
- Follow-Ups:
- Re: Convert PowerPoint refrence to late binding in Access
- From: Douglas J. Steele
- Re: Convert PowerPoint refrence to late binding in Access
- Prev by Date: Re: Is Not Null
- Next by Date: Re: Convert PowerPoint refrence to late binding in Access
- Previous by thread: How do I run vba code in Access without a macro window opening?
- Next by thread: Re: Convert PowerPoint refrence to late binding in Access
- Index(es):
Relevant Pages
|