Windows XP Source Formating using VB in .ppt macro

Joined
Jun 19, 2008
Messages
7
Reaction score
0
I am trying to run a macro in powerpoint which consolidates a folder of .ppts into one presentation. I am currently using a nice little bit of coding which involves a list.txt to gather the necessaries and then build the new presentation. However, the source coding is not maintained. Does anyone know a tidy little insertion which i could use to sort this out. My macro currently looks like this:

ub InsertFromList()
' Inserts all presentations named in LIST.TXT into current presentation
' in list order
' LIST.TXT must be properly formatted, one full path name per line
On Error GoTo ErrorHandler
Dim sListDir As String
Dim sListFileName As String
Dim sListFilePath As String
Dim iListFileNum As Integer
Dim sBuf As String
' EDIT THESE AS NEEDED
sListFileName = "LIST.TXT" ' name of file containing files to be inserted
sListFilePath = "N:\Distribution\Marketing & Products\RFP Team\Michael Fletcher\Outputs\" ' backslash terminated path to folder containing list file
' Do we have a file open already?
If Not Presentations.Count > 0 Then
Exit Sub
End If
' If LIST.TXT file doesn't exist, create it
If Not Dir$(sListFilePath & sListFileName) <> "" Then
iListFileNum = FreeFile()
Open sListFilePath & sListFileName For Output As iListFileNum
' get file names
sBuf = Dir$(sListFilePath & "*.PPT")
While Not sBuf = ""
Print #iListFileNum, sBuf
sBuf = Dir
Wend
Close #iListFileNum
End If
iListFileNum = FreeFile()
Open sListFilePath & sListFileName For Input As iListFileNum
' Process the list
While Not EOF(iListFileNum)
' Get a line from the list file
Line Input #iListFileNum, sBuf
' Verify that the file named on the line exists
If Dir$(sBuf) <> "" Then
Call ActivePresentation.Slides.InsertFromFile(sBuf, ActivePresentation.Slides.Count)
End If
Wend
Close #iListFileNum
MsgBox "DONE!"
NormalExit:
Exit Sub
ErrorHandler:
Call MsgBox("Error:" & vbCrLf & Err.Number & vbCrLf & Err.Description, vbOKOnly, "Error inserting files")
Resume NormalExit
End Sub

I would really appreciate some help on this.

Thanks
 
Joined
Jun 19, 2008
Messages
7
Reaction score
0
...or any other way to keep the source formatting of the slides which are being imported
 

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