C
crtas1
I need help with this VB code. I am a total beginner and am not sure
where or what I am supposed to do to make this code to work in Power
Point. Can someone please walk me though this. Maybe highlight in red
what I am supposed to change in the code and what should be there.
Thanks
Sub ImportABunch()
Dim strTemp As String
Dim strFileSpec As String
Dim oSld As Slide
Dim oPic As Shape
strFileSpec = "C:\PFS Pictures\beach party *.PNG"
' Ex. on a PC: "C:\My Pictures\Flowers\*.PNG"
strTemp = Dir(strFileSpec)
Do While strTemp <> ""
Set oSld = ActivePresentation.Slides.Add ppLayoutBlank
Set oPic =
ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:=strFileSpec,
_
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, _
Left:=0, _
Top:=0, _
Width:=100, _
Height:=100)
' Reset it to its "real" size
With oPic
ScaleHeight 1, msoTrue
ScaleWidth 1, msoTrue
End With
' and optionally, make it fill the slide - to do that, uncomment the
following:
' With oPic
' .Height = ActivePresentation.PageSetup.SlideHeight
' .Width = ActivePresentation.PageSetup. SlideWidth
' End n
' Get the next file that meets the spec and go round again
strTemp = Dir
Loop
End Sub
where or what I am supposed to do to make this code to work in Power
Point. Can someone please walk me though this. Maybe highlight in red
what I am supposed to change in the code and what should be there.
Thanks
Sub ImportABunch()
Dim strTemp As String
Dim strFileSpec As String
Dim oSld As Slide
Dim oPic As Shape
strFileSpec = "C:\PFS Pictures\beach party *.PNG"
' Ex. on a PC: "C:\My Pictures\Flowers\*.PNG"
strTemp = Dir(strFileSpec)
Do While strTemp <> ""
Set oSld = ActivePresentation.Slides.Add ppLayoutBlank
Set oPic =
ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:=strFileSpec,
_
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, _
Left:=0, _
Top:=0, _
Width:=100, _
Height:=100)
' Reset it to its "real" size
With oPic
ScaleHeight 1, msoTrue
ScaleWidth 1, msoTrue
End With
' and optionally, make it fill the slide - to do that, uncomment the
following:
' With oPic
' .Height = ActivePresentation.PageSetup.SlideHeight
' .Width = ActivePresentation.PageSetup. SlideWidth
' End n
' Get the next file that meets the spec and go round again
strTemp = Dir
Loop
End Sub