P
persh
I am trying to import pictures into a powerpoint slide
presentation using this code but i am getting an error:
************************************
Private Sub cmdPowerPoint_Click()
Dim xloop As Integer
On Error Resume Next
Set ppObj = GetObject(, "PowerPoint.Application")
Dim Pic As Shape
Dim Sld As Slide
If Err.Number Then
Set ppObj = CreateObject("PowerPoint.Application")
Err.Clear
End If
On Error GoTo err_cmdOLEPowerPoint
Set ppPres = ppObj.Presentations.Add
'Set ppPres = ppObj.Slides.Add
Debug.Print "before"
'Set oPic = ActiveWindow.Selection.SlideRange.Shapes
Set Sld = ActivePresentation.Slides.Add
(ActivePresentation.Slides.Count + 1, ppLayoutBlank)
Set Pic =
ActiveWindow.Selection.SlideRange.Shapes.AddPicture
(FileName:="c:\prx.jpg", _
LinkToFile:=msoTrue, _
SaveWithDocument:=msoTrue, _
Left:=1, _
Top:=1, _
Width:=275, _
Height:=45)
Debug.Print "after"
..Slides(1).Shapes(1).TextFrame.TextRange.Text
= "Testing1!!!"
ppPres.SlideShowSettings.Run
End Sub
presentation using this code but i am getting an error:
************************************
Private Sub cmdPowerPoint_Click()
Dim xloop As Integer
On Error Resume Next
Set ppObj = GetObject(, "PowerPoint.Application")
Dim Pic As Shape
Dim Sld As Slide
If Err.Number Then
Set ppObj = CreateObject("PowerPoint.Application")
Err.Clear
End If
On Error GoTo err_cmdOLEPowerPoint
Set ppPres = ppObj.Presentations.Add
'Set ppPres = ppObj.Slides.Add
Debug.Print "before"
'Set oPic = ActiveWindow.Selection.SlideRange.Shapes
Set Sld = ActivePresentation.Slides.Add
(ActivePresentation.Slides.Count + 1, ppLayoutBlank)
Set Pic =
ActiveWindow.Selection.SlideRange.Shapes.AddPicture
(FileName:="c:\prx.jpg", _
LinkToFile:=msoTrue, _
SaveWithDocument:=msoTrue, _
Left:=1, _
Top:=1, _
Width:=275, _
Height:=45)
Debug.Print "after"
..Slides(1).Shapes(1).TextFrame.TextRange.Text
= "Testing1!!!"
ppPres.SlideShowSettings.Run
End Sub