D
dlmcfc
Hi,
I have an Access databse with about 150 records in it. I would like to
export selected fields from the database to a Powerpoint presentation.
Each record in the database represents a project, and each project requires
an individual slide.
Each slide would be identical in terms of formatting, but the data in each
text box on the slide would need to be imported from a different field the
Access databse.
I have found some example code on the Internet that has allowed me to export
the data from Access to Powerpoint. I created a 'Form' in Access and assigned
some VB code to a command button. When the button is clicked, a Powerpoint
presentation is created, and the title of each project is placed on an
individual slide, along with the project owners name. Here is the code:
----------------------------------------------------------------
Option Compare Database
Option Explicit
Sub cmdPowerPoint_Click()
Dim db As Database, rs As Recordset
Dim ppObj As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
On Error GoTo err_cmdOLEPowerPoint
' Open up a recordset on the Project List table.
Set db = CurrentDb
Set rs = db.OpenRecordset("Project List", dbOpenDynaset)
' Open up Powerpoint.
Set ppObj = New PowerPoint.Application
Set ppPres = ppObj.Presentations.Add
' Setup the set of slides and populate them with data from the
' set of records.
With ppPres
While Not rs.EOF
With .Slides.Add(rs.AbsolutePosition + 1, ppLayoutTitle)
.Shapes(1).TextFrame.TextRange.Text =
CStr(rs.Fields("Topic_Owner (my:myFields/my:CBT_Topic_Owner)").Value)
.Shapes(2).TextFrame.TextRange.Text =
CStr(rs.Fields("Project_Name").Value)
End With
rs.MoveNext
Wend
End With
Exit Sub
err_cmdOLEPowerPoint:
MsgBox Err.Number & " " & Err.Description
End Sub
-----------------------------------------------------------------------------
My question is, can I add more fields to be exported? Currently there is
only two fields, and I need about 20 per slide.
Also, can I format the slide, so text boxes are aligned, coloured and sized
to my requirements? Could I specify a pre-formatted slide that should be used
when creating the presentation?
I have tried to do this myself, but my lack of coding knowledge is
restricting me!
Many thanks in advance,
dlmcfc
I have an Access databse with about 150 records in it. I would like to
export selected fields from the database to a Powerpoint presentation.
Each record in the database represents a project, and each project requires
an individual slide.
Each slide would be identical in terms of formatting, but the data in each
text box on the slide would need to be imported from a different field the
Access databse.
I have found some example code on the Internet that has allowed me to export
the data from Access to Powerpoint. I created a 'Form' in Access and assigned
some VB code to a command button. When the button is clicked, a Powerpoint
presentation is created, and the title of each project is placed on an
individual slide, along with the project owners name. Here is the code:
----------------------------------------------------------------
Option Compare Database
Option Explicit
Sub cmdPowerPoint_Click()
Dim db As Database, rs As Recordset
Dim ppObj As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
On Error GoTo err_cmdOLEPowerPoint
' Open up a recordset on the Project List table.
Set db = CurrentDb
Set rs = db.OpenRecordset("Project List", dbOpenDynaset)
' Open up Powerpoint.
Set ppObj = New PowerPoint.Application
Set ppPres = ppObj.Presentations.Add
' Setup the set of slides and populate them with data from the
' set of records.
With ppPres
While Not rs.EOF
With .Slides.Add(rs.AbsolutePosition + 1, ppLayoutTitle)
.Shapes(1).TextFrame.TextRange.Text =
CStr(rs.Fields("Topic_Owner (my:myFields/my:CBT_Topic_Owner)").Value)
.Shapes(2).TextFrame.TextRange.Text =
CStr(rs.Fields("Project_Name").Value)
End With
rs.MoveNext
Wend
End With
Exit Sub
err_cmdOLEPowerPoint:
MsgBox Err.Number & " " & Err.Description
End Sub
-----------------------------------------------------------------------------
My question is, can I add more fields to be exported? Currently there is
only two fields, and I need about 20 per slide.
Also, can I format the slide, so text boxes are aligned, coloured and sized
to my requirements? Could I specify a pre-formatted slide that should be used
when creating the presentation?
I have tried to do this myself, but my lack of coding knowledge is
restricting me!
Many thanks in advance,
dlmcfc