Object Does Not Exist

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm going insane. Any help with this would be much appreciated. I've written
some code (I can't put it all here - it's too much) that loops through an
access recordset, places charts within a powerpoint slide, saves the slide,
goes to the next record and does it again. This works fine. I added some code
that creates a table on the slide. The first first record saves fine but on
the second record, even though everything looks like it's being placed
correctly on the slide, even the tables, it suddenly throws an error: Object
Does Not Exist 2147467259 (80004005).

(sigh)
 
Here's the code:

Set rsRowCount = db.OpenRecordset("...

varRowCount = 1
Do While Not rsRowCount.EOF
i = varRowCount
varRowCount = 1 + i
rsRowCount.MoveNext
Loop

Set objGraph = prsPres.Slides(1).Shapes.AddTable(varRowCount, 4,
ChartWidth + 15, ChartTop + 5, ChartWidth, ChartHeight / 2)

With objGraph.Table

With .Rows(1)
.Height = 7
End With

With .Cell(1, 1).Shape.TextFrame
.TextRange.Text = "Company"
.TextRange.Font.Size = 8
.TextRange.Font.Color = 0
.HorizontalAnchor = msoAnchorCenter
.MarginBottom = 0
.MarginLeft = 0
.MarginRight = 0
.MarginTop = 0
End With


With .Cell(1, 2).Shape.TextFrame
.TextRange.Text = "2005-Q1 to 2005-Q4"
.TextRange.Font.Size = 8
.TextRange.Font.Color = 0
.HorizontalAnchor = msoAnchorCenter
.MarginBottom = 0
.MarginLeft = 0
.MarginRight = 0
.MarginTop = 0
End With

With .Cell(1, 3).Shape.TextFrame
.TextRange.Text = "2006-Q1 to 2006-Q4"
.TextRange.Font.Size = 8
.TextRange.Font.Color = 0
.HorizontalAnchor = msoAnchorCenter
.MarginBottom = 0
.MarginLeft = 0
.MarginRight = 0
.MarginTop = 0
End With

With .Cell(1, 4).Shape.TextFrame
.TextRange.Text = "Share Change"
.TextRange.Font.Size = 8
.TextRange.Font.Color = 0
.HorizontalAnchor = msoAnchorCenter
.MarginBottom = 0
.MarginLeft = 0
.MarginRight = 0
.MarginTop = 0
End With

End With

Set rsCompany = db.OpenRecordset("...

varAddRow = 1

Do While Not rsCompany.EOF

i = varAddRow
With objGraph.Table

.Columns(1).Width = 90

With .Rows(i)
.Height = 7
With .Cells.Borders(ppBorderBottom)
.DashStyle = msoLineSolid
.Weight = 1
End With
End With

With .Cell(i + 1, 1).Shape.TextFrame
.TextRange.Text = rsCompany!Company
.TextRange.Font.Size = 8
.TextRange.Font.Color = 0
.HorizontalAnchor = msoAnchorCenter
.MarginBottom = 0
.MarginLeft = 0
.MarginRight = 0
.MarginTop = 0
End With


With .Cell(i + 1, 2).Shape.TextFrame
.TextRange.Text =
FormatPercent((rsCompany!PeriodOneDollarsChangePercent), 2)
.TextRange.Font.Size = 8
.TextRange.Font.Color = 0
.HorizontalAnchor = msoAnchorCenter
.MarginBottom = 0
.MarginLeft = 0
.MarginRight = 0
.MarginTop = 0
End With

With .Cell(i + 1, 3).Shape.TextFrame
.TextRange.Text =
FormatPercent((rsCompany!PeriodTwoDollarsChangePercent), 2)
.TextRange.Font.Size = 8
.TextRange.Font.Color = 0
.HorizontalAnchor = msoAnchorCenter
.MarginBottom = 0
.MarginLeft = 0
.MarginRight = 0
.MarginTop = 0
End With

With .Cell(i + 1, 4).Shape.TextFrame
.TextRange.Text =
FormatPercent((rsCompany!DollarsChangePercent), 2)
.TextRange.Font.Size = 8
.TextRange.Font.Color = 0
.HorizontalAnchor = msoAnchorCenter
.MarginBottom = 0
.MarginLeft = 0
.MarginRight = 0
.MarginTop = 0
End With

End With
varAddRow = 1 + i
rsCompany.MoveNext
Loop

With objGraph.Table
For m = 2 To 4
.Columns(m).Width = 45
Next

With .Rows(i + 1)
.Height = 7
End With
End With
 
Back
Top