macro problem

G

GDaniec

Hi!
I have to collect data in dynamic way (from file) and insert that data
into a powerpoint presentation. The file is changing every second.
Then, if the value of data in file is apropriate, the movie from mpg
file has to be shown.
When the movie is finished, slide with data from file has to be shown
again.
I've been trying to solve it creating three slides.
The first one consist only a command button to start action.
When the button is pressed the code is executed (from now on,
everything has to be done automaticaly - without mouse):
- redirecting to the second slide with data collected from file
- in do while loop data are collected from file every second
- if data is greater then 6 the movie has to be shown, and when it
finished we have to come back to the second slide and continue the
loop
My code looks like that:

Private Sub CommandButton1_Click()

Dim gr As Integer
Dim TMinus As Integer

SlideShowWindows(1).View.GotoSlide (2)
TMinus = 30

Do While (TMinus > -1)

' Suspend program execution for 1 second (1000
milliseconds)

Open "strony.txt" For Input As #1
Input #1, gracz1
Close #1

Sleep 1000


ActivePresentation.Slides(2).Shapes(7).TextFrame.TextRange.Text = gr

If gr > 6 Then
'SlideShowWindows(1).View.GotoSlide (3)
End If

TMinus = TMinus - 1

DoEvents
Loop

End
End Sub

I am new to VBA programming. I don't know how to suspend the loop,
show the movie, come back to slide two and continue "Do While". Can
anyone help me?
 
A

Austin Myers

I've done a little bit of coding around video content and PowerPoint and I
think you are really underestimating the complexity of doing this in stable,
and reliable code. If you want to use code I would strongly recommend
downloading the Windows Media SDK from MS and looking through it.

I would also download the file "vbapp10.chm" while you are at the MS site.
It is the documentation of PowerPoint's object model including events and
methods.

After looking through these two decide if you think its something you want
to take on as a VBA beginner. If so holler back and we'll take a look at
it. First hint, Sleep and Do Events are something you really want to
avoid. :)


Austin Myers
MS PowerPoint MVP Team

Provider of PFCMedia, PFCPro, PFCExpress
http://www.pfcmedia.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