PC Review


Reply
Thread Tools Rate Thread

macro problem

 
 
GDaniec@gmail.com
Guest
Posts: n/a
 
      22nd Mar 2007
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?

 
Reply With Quote
 
 
 
 
Austin Myers
Guest
Posts: n/a
 
      22nd Mar 2007
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



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro will not run with file.xls!macro.macro BillRobPV Microsoft Excel Discussion 2 12th Sep 2008 05:08 PM
Macro within a macro and Macro Prompts =?Utf-8?B?Y29tcGFyaW5pMzAwMA==?= Microsoft Excel Misc 3 7th Jun 2006 01:28 PM
Problem in updating all worksheets of a workbook using a macro that calls another macro saai_ram@yahoo.com Microsoft Excel Programming 3 20th Mar 2006 06:21 AM
Chronic macro problem -How to delete an excel macro Todd Microsoft Excel Crashes 0 30th Jun 2004 05:03 PM
Start Macro / Stop Macro / Restart Macro Pete Microsoft Excel Programming 2 21st Nov 2003 06:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:15 PM.