Text disappearing during loop when creating ppt table

Viewed 5

I am running into an issue when running code to create a powerpoint table from Excel data. When I debug the code, I can see that the code is correctly pulling the data, but it is disappearing at the end of the function. My goal is for the code to loop through all rows of data starting at A6(header), check column F for dates that are older than a week from today, and then take that data and put it into a ppt table with 3 columns.

my code:

dim count, i, j, f as integer: count = 3
dim PPRow as integer: PPRow = 2
dim maxheight as integer: maxheight = 380
slideNo = 4
j=SlideNo
f=1

i = Application.WorksheetFunction.CountA(Sheets("Assignments").Range("A6:A20"))
if i >=1 then

Set PPApp = CreateObject("Powerpoint.Application")
Set PPPres = PPApp.AcitvePresentation
PPAp.ActiveWindow.View.Gotoslide SlideNo

Dim r as long
for r = 7 to 37

if cells(r,"F").value> (Date +7) then
PPPres.Slides(SlideNo).Shapes("tblNonGreenMetrics").Table.Cell(PPRow,1).Shape.TextFrame.Text = Cells(r,"F".offset(o,-5)
PPPres.Slides(SlideNo).Shapes("tblNonGreenMetrics").Table.Cell(PPRow,2).Shape.TextFrame.Text = Cells(r,"F".offset(o,0)

o= o+1

end if
next
end if
end function


thank you
 
0 Answers
Related