A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Powerpoint
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

macro problem



 
 
Thread Tools Display Modes
  #1  
Old March 22nd, 2007, 12:00 AM posted to microsoft.public.powerpoint
[email protected]
external usenet poster
 
Posts: 4
Default macro problem

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.T extRange.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?

  #2  
Old March 22nd, 2007, 01:53 AM posted to microsoft.public.powerpoint
Austin Myers
external usenet poster
 
Posts: 1,631
Default macro problem

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



wrote in message
ups.com...
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.T extRange.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?



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:13 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.