Tech Support Forum banner

.Net Using Interop to insert pictures on a PowerPoint Slide

2676 Views 0 Replies 1 Participant Last post by  pierre44144
I am trying to add a picture to an existing blank PowerPoint slide using VB.Net (Visual Studio 2005) and Interop. The code I use doesn't give an error, but I'm not getting the pictures saved on the slide. Data entered on other slides is saved, so I know the save is working. Any help would be appreciated. Here's the code:

Private Sub InsertPicture(ByRef pres As PowerPoint.Presentation, _
ByVal slide As Integer, _
ByVal folder As String, _
ByVal PicName As String, _
ByVal pType As Integer, _
ByVal outputFolder As String)
On Error GoTo ErrIP

Dim Fullname As String = folder + PicName
Dim Left, Top, Width, Height As Single
Select Case pType
Case 0 'Mini Pic on slide 4
Left = 1.83
Top = 3.83
Width = 1.8
Height = 0.47
Case 1 'Back Pic on slide 5
Left = 0.2
Top = 0.6
Width = 9.9
Height = 2.9
Case 2 'Front pic on slide 5
Left = 0.2
Top = 4.3
Width = 9.64
Height = 1.87
End Select
pres.Slides.Item(slide).Shapes.AddPicture(Fullname, _
MsoTriState.msoFalse, MsoTriState.msoTrue, _
Left, Top, _
Width, Height)
Exit Sub
ErrIP:
'Error Handling is here, removed for display purposes...
End Sub
See less See more
Status
Not open for further replies.
1 - 1 of 1 Posts
1 - 1 of 1 Posts
Status
Not open for further replies.
Top