animation macro

  • Thread starter Thread starter Ranjan
  • Start date Start date
R

Ranjan

Hi
I have a file with 10 lines of text. I want to read each line of the text
file in powerpoint and each line is shown one after another as animation
would do.

I have tried usin the record a macro function and it some doesn't record the
animation stuff.

I would welcome any suggestion.

Thanks
Ranjan
 
Sub ReadFileAndAnimate()
Dim sh As Shape
Set sh =
ActivePresentation.Slides(1).Shapes.AddTextbox(msoTextOrientationHorizontal,
10, 10, 600, 500)
With sh
.TextFrame.TextRange.Text = GetText("C:\\sample.txt")
.AnimationSettings.TextLevelEffect = ppAnimateByAllLevels
.AnimationSettings.TextUnitEffect = ppAnimateByWord
End With
End Sub

'http://www.exceluser.com/explore/questions/vba_textcols.htm
Function GetText(sFile As String) As String
Dim nSourceFile As Integer, sText As String

''Close any open text files
Close

''Get the number of the next free text file
nSourceFile = FreeFile

''Write the entire file to sText
Open sFile For Input As #nSourceFile
sText = Input$(LOF(1), 1)
Close

GetText = sText
End Function

This will make a textbox and load the txt file. Also this will make a custom
animation for the textbox. Please let me know if you looking for some other
thing
 
Hi
Thanks a lot.
That does exactly what I had asked in my question. With some more addition
it would be perfect.


My text file has three columns. First column of each line is a question and
second column is a hint and third column is an answer to the same question.
I want the animation to be such that first a question appears in red . Once
it is clicked the hint which is indented appears in green. After another
click, answer which is further indented appears in blue. All of them turn
grey before the next question appears.

It might happen that there are 200 questions in a text file and that would
be too much stuff to put on to a single slide. In that case it should add to
new slide.

The following blog has some information about indentation and levels and
dimcolor and I started making my own program based on it but I am stuck. I
think a hybrid of your code and the code from following blog would work great


http://blogs.msdn.com/andrew_may/archive/2004/06/21/161537.aspx
The above tips appear to have been written for powerpoint 97 and 2000. I
have powerpoint 2003.

I really appreciate all your help
Thanks
Ranjan
 
Good to know you got out of the struck. Let us know when you have more
problem. Thanks for link... will be helpful for a lot later too
 
Back
Top