Powerpoint macro inserting pictures

P

Paul Johnson

I have a problem with this macro, I has been working for years, It inserts
pictures from a directory called import to a blank powerpoint. but the user
changed OS to XP home. And it stopped working
I thought this is an easy one just create "C:\My Documents\my
pictures\import\" as the bin to drop the picture files in as it was, and It
should work.
It now works on my machine XP pro. Office 2000. But not on the users XP
home Office 97.
The macro does not like this line:

.FileName = "*.*"

If I put the file name in of one file then it works for that file

As I say this is working fine on my machine, Any Ideas?

Many Thanks

Paul



Sub insertpic()
'
' Macro recorded 24/10/2002 by Paul Johnson
'

Set fs = Application.FileSearch
With fs
.LookIn = "C:\My Documents\my pictures\import\"


.FileName = "*.*"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
' MsgBox .FoundFiles(i)
ActiveWindow.View.GotoSlide
Index:=ActivePresentation.Slides.Add(Index:=1,
Layout:=ppLayoutBlank).SlideIndex
'ActivePresentation.Slides.Add(Index:=1,
Layout:=ppLayoutTitle).SlideIndex

' ActivePresentation.Slides.Range.Select
'ActiveWindow.Selection.TextRange.Characters(Start:=1, Length:=0).Select

ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:=.FoundFiles(i),
LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=40, Top:=40,
Width:=346, Height:=277).Select
With ActiveWindow.Selection.ShapeRange
' .ScaleWidth 1.23, msoFalse, msoScaleFromTopLeft
' .ScaleHeight 1.23, msoFalse, msoScaleFromTopLeft
End With

Next i
Else
MsgBox "There were no files found."
End If
End With





End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top