Hi Candace,
Dim path As String
path = "C:\1.jpg"
Dim s As Shape
Set s = ActiveWindow.Selection.SlideRange(1).Shapes.AddPicture(path,
msoFalse, msoCTrue, 10, 10, 600, 450)
This is the code for adding a picture at coordinate 10,10 with width 600 and
height 450. If you need open file to pop up to select te picture, you can
check this link: http://www.meadinkent.co.uk/aopendlg.htm
Thanks,
Vindys
> Can someone please help me with a line or two of code that would allow me to
> insert a picture (from file) into my slideshow using vba code?
[quoted text clipped - 5 lines]
>
> Thanks.
Candace - 24 Apr 2008 16:33 GMT
Okay, I tied the "GetStarted" procedure from the following code to a shape on
my slideshow, but nothing happened. Any suggestions?
Dim path As String
path = "C:\student\20080421\Math_p283_13-21_pictures"
Sub GetStarted()
path14 = path & "\14-01.png"
Dim s As Shape
Set s = ActivePresentation.Slides("problem14").Shapes.AddPicture(path14, _
msoFalse, msoCTrue, 10, 10, 600, 450)
End Sub
> Hi Candace,
>
[quoted text clipped - 21 lines]
> >
> > Thanks.
vindys - 24 Apr 2008 19:40 GMT
Candace,
I think the function is fine other than that path =
"C:\student\20080421\Math_p283_13-21_pictures" will give "Invalid outside
Procedure if you defining the string outside procedure. So make it as a Const
if you want to define it outside procedure.
Const path As String = "C:\student\20080421\Math_p283_13-21_pictures"
> Okay, I tied the "GetStarted" procedure from the following code to a shape on
> my slideshow, but nothing happened. Any suggestions?
[quoted text clipped - 34 lines]
> > >
> > > Thanks.
You might want to look at the code here:
Batch Insert a folder full of pictures, one per slide
http://www.pptfaq.com/FAQ00352.htm
--David

Signature
David M. Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
> Can someone please help me with a line or two of code that would allow
> me to insert a picture (from file) into my slideshow using vba code?
[quoted text clipped - 5 lines]
>
> Thanks.