Adding Picture to slide problem

I have been trying to add a picture frame to a slide using the example provided on the documentation page. Below is what I have so far.

Dim myImageName As String

myImageName = Row(3) 'gets the picture file name

'Add the picture

Dim picid As Integer = pres.Pictures.Add(New Picture(pres, System.Configuration.ConfigurationSettings.AppSettings(“ImagePath”) & myImageName))

'add the picture frame and add the picture to the slide

Dim pf As PictureFrame = Slide.Shapes.AddPictureFrame(picid, 0, 0, 2000, 2000)


Everything seems to work down to the “Dim PF” statement above. I get an error when it runs stating the object has not been set. I am pretty sure I have not set the slide object correctly.


I have "Dim Slide as Slide"

I have not been able to figrue out what to make “Slide” equal to. If I remove the “Dim Slide as Slide” then I get a squigley line under “Slide.Shapes”. I must be missing something simple. Can you give me the proper settings.

Gil

Dear Gil,

For example you would like to insert picture to the first slide in a presentation.
In this case:

Dim Slide as Slide = pres.GetSlideByPosition(1)

Thanks, this helped a lot.

Gil