Hi guys,
I have this VBA code which I use for transferring data from my data sheet to slides in PowerPoint - it works fine.
However in PowerPoint I'm currently forced to transfer data to "text-objects" which is a bit of a drag because I'm used to working in a table in Powerpoint when organizing data.
Therefore my question is how to edit my VBA code so I can transfer data to a table in PowerPoint instead of an object.
Thanks.
Here's the VBA code:
I have this VBA code which I use for transferring data from my data sheet to slides in PowerPoint - it works fine.
However in PowerPoint I'm currently forced to transfer data to "text-objects" which is a bit of a drag because I'm used to working in a table in Powerpoint when organizing data.
Therefore my question is how to edit my VBA code so I can transfer data to a table in PowerPoint instead of an object.
Thanks.
Here's the VBA code:
Code:
Sub TDPTest()
Dim shtStudent As Worksheet
Dim strMedarbejder As String
Dim strTitel As String
Dim strFastholdelse As String
Dim lngRow As Long
Dim objPPT As Object
Dim objPres As Object
Dim objSld As Object
Dim objShp As Object
Set shtStudent = Worksheets("Ark1")
Set objPPT = CreateObject("Powerpoint.Application")
objPPT.Visible = True
Set objPres = objPPT.presentations.Open(ThisWorkbook.Path & "\JBX_test.ppt")
objPres.SaveAs ThisWorkbook.Path & "\TDPTest.ppt"
lngRow = 2
Do While shtStudent.Cells(lngRow, 2) <> ""
strMedarbejder = shtStudent.Cells(lngRow, 1)
strTitel = shtStudent.Cells(lngRow, 2)
strFastholdelse = shtStudent.Cells(lngRow, 3)
Set objSld = objPres.slides(1).Duplicate
For Each objShp In objSld.Shapes
If objShp.HasTextFrame Then
If objShp.TextFrame.HasText Then
objShp.TextFrame.TextRange.Replace "<Medarbejder>", strMedarbejder
objShp.TextFrame.TextRange.Replace "<Titel>", strTitel
objShp.TextFrame.TextRange.Replace "<Fastholdelse>", strFastholdelse
End If
End If
Next
lngRow = lngRow + 1
Loop
objPres.slides(1).Delete
objPres.Save
objPres.Close
End Sub
Last edited: