Need macro to delete all slides then propagate them again

S

skirchdo

I have a presentation which uses a master slide which will pull an
outline txt file to automatically create numerous slides. This outline
txt file is updated constantly from an database which ports its data
into this txt file. The txt file length is constantly changing which
means the number of slide being generated when powerpoint "inserts
slides from outline" will also change. One time there may be 50 slides
then the next time it might be 68 then next time 103, etc. It's
basically unknown how many slides there will be each time.

So what I need is a macro that will "select all" of the slides, delete
them (not the master of course), then insert the txt from the external
file using the "Slides from Outline" function.

Next I have tried to utilize the OfficeOnce Event Generator to run the
macro again upon the end of the slide. This in effect is supposed to
refreshes the slides at the end of the slideshow (e.g deleting them
then re-inserting the outline data as a whole new set of slides).

I can get the initital macro to highlight all of the slides and then
delete (well maybe not delete) them and insert the outline source data
which creates the individual slides, but when the Event Generator runs
the macro again, it doesn't delete the original slides but it appends
the new outline data to the old slides which doubles them...this
happens each time adding more and more slides each time.

So first of all, why is the macro deleting all of the slides the first
time it's run, but not when it's run from the end of slide macro?

And finally, once I get this part above to work, I need to re-run the
slide show once the data is refreshed.

This needs to all work automatically once it's started the first time.
It needs to be an infinite loop until someone manually ends the
slideshow, all the while updating the slides after each slideshow.

This is basically a hotel event calendar that is pumped to TV screens
throughout a hotel/conference center. The slide outline data is the
conference center events data (Groups, Times, Rooms, Etc).

We are trying to get Powerpoint to do this because of the cost of
buying a proprietary system built specifically for this function. I
feel I'm really close to getting this done but I'm hitting these
hurdles which are beyond my powerpoint macro building abilities. Can
someone helpd me please?

Here are my two macros which work independantly but not together.

Sub RefreshData()

ActiveWindow.Selection.SlideRange.Delete
ActivePresentation.Slides.InsertFromFile FileName:="D:\Documents
and Settings\550490\My Documents\EVENTS.TXT", Index:=0
With ActivePresentation.SlideShowSettings
.ShowType = ppShowTypeSpeaker
.LoopUntilStopped = msoFalse
.ShowWithNarration = msoTrue
.ShowWithAnimation = msoTrue
.RangeType = ppShowAll
.AdvanceMode = ppSlideShowUseSlideTimings
.PointerColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
.Run
End With
SlideShowWindows(Index:=1).View.First
End Sub

Sub OnSlideShowEnd()

Application.Run "'ABCDEFG.ppt'!RefreshData"
SlideShowWindows(Index:=1).View.First
End Sub

Any help would be greatly appreciated.
 
S

skirchdo

Thanks for replying to this problem Steve. I figured it had something
to do with what you said. I'm just not familiar enough with this stuff
to know exactly what I'm looking at to debug.

However when I use your code I get a message stating, "Compile Error:
Method or Data Member not found". Then when the debugger opens and the
first line "Sub RefreshData()" is highlight.

This is the full macro verbatim:

Sub RefreshData()

With ActivePresentation.Slides
If .Count > 0 Then
.Range.Delete
.InsertFrmFile "D:\{path removed by poster}\EVENTS.TXT", 0
End If
End With
End Sub

Is this wrong?

I cut a pasted your code and then replaced the filename with the path
to my data text file. Am I missing something?

Just FYI I'm using Powerpoint 2003.

I REALLY appreciate you help!
 
K

Kirch66

Steve,

Nevermind, I psted the code literally and needed to actually have
InsertFromFile spelled out. You had it abreviated. Sorry, I didn't
see that before posting. I fixed it and the code works great. So one
part of my three-part problem is solved. Thanks!
 
K

Kirch66

Ok so now when the macro updates all of the slides with the new data,
my old code at least used to then run the presentation slide show. Now
it doesn't run. What code do I use to call the slideshow to run after
the data/slides have been updated?
 
D

David M. Marcovitz

Because you are already in Slide Show mode, can you just put this at the
end of your code to go to the first slide resetting all animations?

ActivePresentation.SlideShowWindow.View.GotoSlide 1, msoTrue

--
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.PowerfulPowerPoint.com/
 
K

Kirch66

Steve,

I got it all to work now. I ended up using the method in this link
(http://www.awesomebackgrounds.com/powerpointlinking.htm) to loop the
thing and re-run the macro to refresh the data. It works quite well
actually. It's a nested presentation this way.

I wouldn't have gotten this finished without your nudge in the right
dorection though. Thanks a bunch.

Now if I could only figure a way to put the current local temperature
in the lower left corner.
 
D

David M. Marcovitz

Any time ...


Oooh, Technology in Search of a Problem! My favorite game!

You could glue a thermometer to the screen.

Or find a web link to the local weather station and use Shyam's Live
Web addin to include the weather station's site on the screen.

Or ... it gets better the longer you play ... a web cam focused on a
thermometer readout and streaming its video output to a web server,
which you pick up and beam onto the slide using Austin's PFC Media and
its live link feature.

Your move. ;-)

You missed one. You just put a box with 72 degrees in the corner, and
then be sure to set the thermostat in the room to 72.
 
K

Kirch66

The temperature was to help out the hotel guests with a weather report.
But it's not gonna work since the firewall gods won't allow it. Too
bad.
 
K

Kirch66

Well I spoke too soon about the solution working. When I run the
original presentation in the new nested loop, it won't run the macro to
refresh the data. I was running test yesterday and found this out.
Darnit! Apparently the OfficeOne Event Generator "OnSlideShowEnd" that
is supposed to run at the end of the original presentation doesn't get
seen as the end of the slideshow when it's running as a nested
slideshow. CRAP!

Looks like I'm back to square one on how to make this thing work. Any
ideas?
 
K

Kirch66

Steve,

Well I spoke too soon about the solution working. When I run the
original presentation in the new nested loop, it won't run the macro to

refresh the data. I was running test yesterday and found this out.
Darnit! Apparently the OfficeOne Event Generator "OnSlideShowEnd" that

is supposed to run at the end of the original presentation doesn't get
seen as the end of the slideshow when it's running as a nested
slideshow. CRAP!

Looks like I'm back to square one on how to make this thing work. Any
ideas?

Thanks,
Shawn
 
K

Kirch66

Thanks Steve. I emailed him with a decription of the problem. I hope
he can help. I don't want to have to write a clunky DOS batch file to
perform some of this. I wanted a clean relatively self containted
system to do this. I'm trying to sell my customer off on replacing
their old out-dated events display system with this.
 
K

Kirch66

Steve,

I got an email back from Chirag and he fixed the problem perfectly. I
was trying to update the data refresh at the end of the nested
slideshow. He changed it to update the data on the second slide of the
master, just before calling the nested slideshow for view. It updates
at the begining of the nested slideshow instead of at the end of it
where I had my macro pointing. It works like a charm!

Thanks for pointing me to him. I really appreciate it.

Shawn
 

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