Results 1 to 5 of 5
  1. #1
    Jeff Lance is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2021
    Posts
    8

    VBA to size and position a PowerPoint Text box

    I am looking for Access VBA code to size and position a PowerPoint Text box

    I am work to create a powerpoint slide with information that I have in an access table.



    I have code that opens my powerpoint templet and inserts my information from the table into the powerpoint.

    The only way I have found to identify my boxes in a powerpoint is item 1, item 2, so on so on......

    I have code to manage the text, size, color, justification ....


    I am also trying to understand the the do until end of table command.

    Once I get the powerpoint to build the way I want I intend to create a slide for every entry in the table.

    unfortunately my access in on a platform that I can not export.

    Thanks for any help and advise you can provide!!

    Windows 10, Office 365

    Jeff.

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    I've little experience of automating PowerPoint from Access but I have another solution that may work for you.
    Using a web browser control, it's possible to view PowerPoint files within Access.
    Depending on the type of PPT file used, you will also be able to edit it within Access if you wish:

    This screenshot shows a slide with the right click context menu allowing me to edit the slides if I wish:
    Click image for larger version. 

Name:	Capture2.jpg 
Views:	15 
Size:	101.3 KB 
ID:	45730

    and this shows the same file in design view within Access:
    Click image for larger version. 

Name:	Capture1.jpg 
Views:	15 
Size:	122.6 KB 
ID:	45729

    Apologies for the huge images. They were full screen.

    NOTE:
    1. If the PPT file opens outside Access, run the registry fix using the .reg file supplied with the zip file
    2. If you get an open/save dialog message each time , let me know and I'll provide a solution for that as well

    Hope it helps
    Attached Files Attached Files
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    I've done a lot of PPT automation, and it isn't always straight forward.
    In powerpoint you can change the name of the objects by editing them in the object explorer (Press Alt+F10), to something more meaningful.

    The easiest way to make a table to a specific number of rows (Assuming you have a template file with the single headings row in an existing table) is to open a recordset on your data then step through it and use something like
    (i've not set up the recordset here, you'll need to add that in - Air code untested but this is the general idea.)
    Code:
    rs.Movelast
    rs.Movefirst
    iTblRows = rs.RecordCount
    
    With PowerpointObj.Slides(1)
         
         With .Shapes("YourTableShapeName")
             For iRow = 1 To iTblRows
                 .Table.Rows.Add
                 .Table.Cell(iRow,1).Shape.TextFrame.TextRange.Text = rs.Fields("YourFirstFieldname")
                 .Table.Cell(iRow,2).Shape.TextFrame.TextRange.Text = rs.Fields("YourSecondField")
                 etc etc
                 rs.movenext
             Next iRow   
        End With 
    End With
    You may need to adjust the row count to allow for heading rows etc.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #4
    Jeff Lance is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2021
    Posts
    8
    The F10 was a great tip, when using the VBA code in Access I found that you still have to use the Item 1, Item 2...... But renaming the Items in the PP helped me to mark targets to load My information from Access.
    I am trying and Idea that someone else gave me to use Shapes instead of text boxes. I will let you know how that works out.

    Thanks for the tips and info.

  5. #5
    Jeff Lance is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2021
    Posts
    8
    Thank you for the idea on how to resolve the issue.

    I am creating the PPTs to insert into another product. so it is the creation of the PPT that is the key

    Jeff

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

Similar Threads

  1. Replies: 1
    Last Post: 05-28-2020, 01:15 PM
  2. setting text box size
    By ntambomvu in forum Access
    Replies: 1
    Last Post: 10-26-2017, 03:29 AM
  3. Rich text - text color and size
    By Subs in forum Reports
    Replies: 3
    Last Post: 11-08-2013, 10:36 AM
  4. Replies: 1
    Last Post: 03-13-2012, 08:35 PM
  5. Position text boxes on form
    By Mclaren in forum Forms
    Replies: 4
    Last Post: 05-10-2011, 12:24 PM

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