• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Inserting random lines from a text file into Powerpoint 2007 (without replacement)

Ichigo

Platinum Member
I have zero experience with VBA.

My only real programming experience is a bit in Python for a CS course (and that was basic, basic stuff).

This is what I want to do:

On each slide, generate n text boxes (let's just say 6 for this example) that import random lines of text from a given text file (let's say ex.txt) without replacement, such that if ex.txt has 20 lines of text and I want each text box to import 2 lines, 12 unique lines of text are taken from ex.txt. So, random permutations generated each and every slide.

I've Googled for this kind of code or even tutorials that would include the necessary information for me to make it myself, but I've failed to find anything. The random generator seems like it would be the most difficult thing, but my lack of VBA experience means I don't even know how to grab text from a text file and insert it in a specific text box and apply formatting (bold, italics, etc.).

So if anyone can help me out in any way possible, please do.

P.S. No this is not homework or anything like that.
 
I really don't have much of any VBA experience either. However, I'll point you to an algorithm for randomizing the order of data, the Knuth shuffle. The VB.NET example may be closest to what you want. If you only want some of the lines out of the text file, once you have enough lines selected, just skip the rest.
 
Back
Top