Creating PPT automatically from .txt / .doc

M

Mo

Hi,

I wanted to automatically create (using VB or Java) a PPT file from a
formatted .txt or .doc file.

Any help would be really appreciated as I am a novice.

Thanks!
Mo
 
B

Bill Dilworth

A general hint would be to look at the native Send To PowerPoint feature in
Word.

Post what code you have and we will offer suggestions for
improvements/problem fixes. You should also include a bit of information
about how this code will be used, since single user programs do not need as
much instruction/interface-design/idiot-proofing as do distributable
software versions.


--
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.
..
..
 
M

Mo

Thanks a lot Bill for your reply. But I do not have anything to go ahead with
(i.e. no sample code) So kindly advise me where shall I start from.

The task that I am looking at : given a text document (preferably .txt) get
it into a PPT automatically. (I do not need an interface for the task.
Everything that I want to get into the PowerPoint is predetermined. The .txt
file is an output of prior processing so the entire application needs to be
automated.).

Thanks a lot for your time.

Mo
 
D

David M. Marcovitz

Here is a little code that might get you started. This is something that
I was playing with to allow someone to create multiple-choice questions
from a text file. It reads a text file named "mytestfile.txt" and adjusts
slide 2 based on what it finds. It puts the first line of text into the
text box that is shape 1, the second line into shape 2, and the third
line into shape 3. It's not everything you want, but it should get you
started.

Sub AdjustQuestion()
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fs, f
Dim theQuestion As String
Dim answer1 As String
Dim answer2 As String
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("mytestfile.txt", ForReading, TristateFalse)
theQuestion = f.readline
answer1 = f.readline
answer2 = f.readline
ActivePresentation.Slides(2).Shapes(1).TextFrame.TextRange.Text _
= theQuestion
ActivePresentation.Slides(2).Shapes(2).TextFrame.TextRange.Text _
= answer1
ActivePresentation.Slides(2).Shapes(3).TextFrame.TextRange.Text _
= answer2

f.Close
End Sub

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
D

David M. Marcovitz

You'll probably need someone with more experience than in matters related
to opening other PPT files from within one file. I should probably look
into this, but I never have done it.

However, a minor problem that I see in your code is that all your Dim and
Const statements should go before any other code. That is, the problem
line and the two lines after it should go after the last Dim line.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 

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