Solved

Powerpoint VBA, reading a file and displaying the text on a slide.

Posted on 2013-06-26
3
1,249 Views
Last Modified: 2013-07-01
Hi Team,

   Just need help finishing a snippet of code from here   -->http://www.pptfaq.com/FAQ00913_Use_VBA_to_read_text_from_a_file.htm.   I am using Powerpoint 2010.

  We have a Help Desk Center where we need to display on large screens live stats that are updated by some external scripts.  e.g. files generated would be numbers for  NewIncidents.txt, UrgentTickets.txt, AgedTickets.txt

  I am not a VBA programmer, but based on the example in the link above, how do I make a looping powerpoint presentation that will open 3 text files, as above, assign the contents   to VBA variables and have Powerpoint display them, one variable per slide (say 15 seconds per slide together with some title text on the slide), then at the end of the presentation, VBA will re-read the files again in case they changed, then loop back to the start?

Thanks very much.
0
Comment
Question by:rleyba828
  • 2
3 Comments
 
LVL 35

Expert Comment

by:Robert Schutt
ID: 39285582
I couldn't understand why nobody was answering this, but I was stunned to find out that PowerPoint doesn't have automatic events out of the box.

I thought this would be an ideal way to do what you want: when the slide changes, read the file based on slide index and put the contents in it.

What you need for that is an add-in for example: http://skp.mvps.org/autoevents.htm 

Note that you need to follow the instructions carefully; on lowering macro security (follow the link below the code on the page you posted), on installing the add-in and then you need to enable the events in the new menu it creates under Tools.

Settings may depend on your PPT version as well, I have a pretty old version but it works nice.

Attached is a zip file with the slideshow (already set up for 15 seconds, repeat, kiosk mode) and some example text files.
FileShow.zip
0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 39289497
I hope you're still interested in this, I discovered a problem with opening the files from the same directory where the .ppt is, you'll probably want to change this anyway but to use the files I included in the zip (regardless of what PowerPoint considers the current directory) you could change this line in Sub ReadAsciiFile:
sFileName = ActivePresentation.Path & "\file" & Index & ".txt"

Open in new window

0
 

Author Comment

by:rleyba828
ID: 39289693
Hi Robert,

   Thanks for this...I followed the steps to modify security settings, and everything is working fine.  Great help.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
The viewer will learn how to edit animations within the presentation, incorporate sound, and set everything up with timing.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question