Thread: [Solved] Access/PPT VBA difficulties
View Single Post
 
Old 03-05-2015, 02:35 PM
Thompyt Thompyt is offline Windows 8 Office 2010 64bit
Novice
 
Join Date: Mar 2015
Location: El Paso, TX
Posts: 8
Thompyt is on a distinguished road
Default Access/PPT VBA difficulties

I am starting out with the following code for PPT interface. I get it to open, display a title and a field, but it makes a new slide each time. I can change the while next loop so that only the Field changes and 1 slide is made. BUT the field swaps until it gets to EOF. I would like it to insert a new line for each record. I would like to have 5 fields to insert.

Title
Levels
CR_No
Change Requested
Status

Code:
Sub cmdPPT_Click()
    Dim db As Database, rs As Recordset
    Dim ppObj As PowerPoint.Application
    Dim ppPres As PowerPoint.Presentation
 
    On Error GoTo err_cmdOLEPowerPoint
 
    Set db = CurrentDb
    Set rs = db.OpenRecordset("Copy of Weekly Closed", dbOpenDynaset)
 
    Set ppObj = New PowerPoint.Application
    Set ppPres = ppObj.Presentations.Add
 
    With ppPres
        With .Slides.Add(rs.AbsolutePosition + 1, ppLayoutTitle)
                .Shapes(1).TextFrame.TextRange.Text = CStr(rs.Fields("[Levels]").Value)
                .Shapes(1).TextFrame.TextRange.Characters.Font.Size = 30
        While Not rs.EOF
                .Shapes(2).TextFrame.TextRange.Text = CStr(rs.Fields("[Closed]").Value)
           rs.MoveNext
        Wend
    Exit Sub
err_cmdOLEPowerPoint:
    MsgBox Err.Number & " " & Err.Description
    End With
    End With
End Sub
I am trying to make the below example on PPT:

Reply With Quote