View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Macro to generate powerpoint slides

Note that if the path is included in the txt file list then use this
version...


Sub InsertSlidesFromFile()
' Inserts slides from a list of PPTs stored in a txt file
Dim vList, n&
Const sPath$ = "C:\documents\"

vList = Split(ReadTextFile(sPath & "TestPP.txt"), vbCrLf)
On Error GoTo Cleanup
With Application
For n = LBound(vList) To UBound(vList)
'Add a new slide where we will open the file (hyperlink)
With .Presentations.Add
'Insert the files into the slide

.slides.InsertFromFile vFile(n), .slides.Count + 1
End With '.Presentations.Add
Next 'n
End With 'Application
Cleanup:
End Sub

Function ReadTextFile$(Filename$)
' Reads large amounts of data from a text file in one single step.
Dim iNum%
On Error GoTo ErrHandler
iNum = FreeFile(): Open Filename For Input As #iNum
ReadTextFile = Space$(LOF(iNum))
ReadTextFile = Input(LOF(iNum), iNum)

ErrHandler:
Close #iNum: If Err Then Err.Raise Err.Number, , Err.Description
End Function 'ReadTextFile()


--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion