Can PowerPoint export plain text files?

A

admin4office

The following macro opens PowerPoint files in C:\src\ and saves them as text
files in C:\dest\. (The goal is to index the text using Perl). Unfortunately,
the saved files contain lots of markup language. Does anyone know how to
remove this markup language? The line that does the saving is marked with
"<===**". Many thanks.

Sub mSavePPt()
Dim srcPath As String
Dim destPath As String
Dim sName As String
Dim pt As Presentation
srcPath = "C:\src\"
destPath = "C:\dest\"
sName = Dir(srcPath & "*.ppt")
Do
Set pt = Presentations.Open(srcPath & sName)
ActivePresentation.SaveAs destPath & pt.Name & ".txt", _ <===**
FileFormat:=ppSaveAsRTF
<===**
ActiveWindow.Close
sName = Dir()
Loop While sName <> ""
End Sub
 
B

Bill Dilworth

If PowerPoint was a text based program this would be fine, but is graphic by
nature and you are trying to save it as test.

You will need to open the presentation, then iterate thru each of the slides
and each of the shapes on those slides to pull out any text that may be
present.

Something like:
----Begin Code------

Sub April15th()

Dim oSld As Slide
Dim oShp As Shape

Open "c:\Output.txt" For Output As #1

For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
If oShp.HasTextFrame Then _
Print #1, oShp.TextFrame _
.TextRange.Text & vbCr
Next oShp
Next oSld

Close #1

End Sub
----End Code------


--
Bill Dilworth
Microsoft PPT MVP Team
Users helping fellow users.
===============
Please spend a few minutes checking vestprog2@
out www.pptfaq.com This link will yahoo.
answer most of your questions, before com
you think to ask them.

Change org to com to defuse anti-spam,
ant-virus, anti-nuisance misdirection.
..
..
 
A

admin4office

Thanks to both of you!

Admin4Office

Steve Rindsberg said:
You're saving as RTF -- Rich Text Format -- which by definition includes
formatting.

There are several routines to collect text from placeholders, notes etc. and
export to plain ASCII text files here:

Exporting stuff
http://www.rdpslides.com/pptfaq/index.html#Exporting_stuff

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 

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