Results 1 to 3 of 3
  1. #1
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839

    PPT 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:

    Click image for larger version. 

Name:	Example1.jpg 
Views:	15 
Size:	98.9 KB 
ID:	19933

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    [QUOTE=Thompyt;266845]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
                    do While rs.eof <> true
                         .Shapes(2).TextFrame.TextRange.Text = CStr(rs.Fields("[Closed]").Value)
                         rs.MoveNext
                    loop
            Wend
        wend
        Exit Sub
    err_cmdOLEPowerPoint:
        MsgBox Err.Number & " " & Err.Description
        End With
        End With
    End Sub

    I don't see how you're looping in your recordset currently you can try the above code or in your recordset loop use something like

    debug.print rs!closed

    to see if your code is actually cycling through all the records.

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    note, it also looks like you're not closing your loops properly

    You have two WITH statements and a DO loop and you only have one Wend statement so I'm not sure how this code would run at all without bombing out.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 12-30-2014, 02:23 PM
  2. Query difficulties
    By jgelpi16 in forum Access
    Replies: 8
    Last Post: 05-10-2011, 02:11 PM
  3. Updating Difficulties
    By BigCat in forum Forms
    Replies: 1
    Last Post: 05-10-2011, 07:53 AM
  4. Expression Difficulties
    By Lea in forum Access
    Replies: 8
    Last Post: 01-18-2011, 04:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums