prabha_friend
Prabhakaran Karuppaih
- Local time
- Today, 15:33
- Joined
- Mar 22, 2009
- Messages
- 880
Code:
Sub Greenstar()
Dim myobj As New PowerPoint.Application
Dim temp As Variant
DoCmd.OutputTo acOutputReport, "Greenstar", acFormatXLS, CurrentProject.Path & "\Greenstar.xls"
Excel.Application.Visible = True
Workbooks.Open (CurrentProject.Path & "\Greenstar.xls")
myobj.Visible = msoCTrue
myobj.Presentations.Open (CurrentProject.Path & "\star.pptx")
myobj.ActivePresentation.Slides(1).Shapes(1).Copy
ReDim temp(5)
For Each cell In Range(Rows(2), Rows(Cells.SpecialCells(xlCellTypeLastCell).Row)).Cells.SpecialCells(xlCellTypeConstants).Cells
Select Case cell.Column
Case 1
'ReDim Preserve temp(0)
Set temp(0) = myobj.Presentations.Add
Case 2
'ReDim Preserve temp(1)
Set temp(1) = temp(0).Slides.Add(temp(0).Slides.Count + 1, ppLayoutBlank)
Case 3
'ReDim Preserve temp(2) 'Country_Code
If temp(1).Shapes.Count = 0 Then Set temp(2) = temp(1).Shapes.AddTextbox(msoTextOrientationHorizontal, 10, 15, 100, 10) Else Set temp(2) = temp(1).Shapes.AddTextbox(msoTextOrientationHorizontal, 10, temp(4).Top + temp(4).Height + 15, 100, 10)
temp(2).TextFrame.TextRange.Text = cell.value
Case 4
'ReDim Preserve temp(3) 'Process_Name
Set temp(4) = temp(1).Shapes.Paste
If temp(1).Shapes.Count = 1 Or cell.Offset(-1, -1).value <> "" Then
Set temp(3) = temp(1).Shapes.AddTextbox(msoTextOrientationHorizontal, 10, temp(2).Top + 15, 200, 10)
With temp(4)
.Left = 10
.Top = temp(3).Top + 15
End With
Else
Set temp(3) = temp(1).Shapes.AddTextbox(msoTextOrientationHorizontal, temp(3).Left + temp(3).Width, temp(2).Top + 15, 200, 10)
With temp(4)
.Left = temp(3).Left
.Top = temp(3).Top + 15
End With
End If
temp(3).TextFrame.TextRange.Text = cell.value
End Select
Next cell
End Sub
why am I getting a Run-time error '424'
Object required
in the else section of the code below:
Code:
If temp(1).Shapes.Count = 0 Then Set temp(2) = temp(1).Shapes.AddTextbox(msoTextOrientationHorizontal, 10, 15, 100, 10) Else Set temp(2) = temp(1).Shapes.AddTextbox(msoTextOrientationHorizontal, 10, temp(4).Top + temp(4).Height + 15, 100, 10)