How to reference a table in a powerpoint slide using VBA

I needed to find out how to populate a table cell in a PowerPoint using VBA.

As in the example on creating PowerPoint files I posted I used a macro
recorder to figure out the VBA and then used Google to find someone
else who converted the code before 🙂

<script language=vbScript>
Sub CreatePPT()
    Set wApp = CreateObject(“PowerPoint.Application”)
    wApp.visible=true

    pptLoc=document.getElementById(“pptLoc”).value
    set objPres = wApp.presentations.open(pptLoc)  

    //Where The name of the Table is “Table 7”

    objPres.Slides.Item(1).Shapes(“Table 7”).Table.Cell(2,2).Shape.TextFrame.TextRange.Text = “10/20/03”

End Sub

</script>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s