Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting text to become Powerpoint slides 1

Status
Not open for further replies.

OsakaWebbie

Programmer
Feb 11, 2003
628
JP
I asked this in the MS Office forum, but they didn't have a non-coding answer for me and suggested I try here.

I want to have a database (Internet-based) of information, and using dynamic queries (in my case, in PHP) pull info from it and put it together in a way that it can make new slides in a Powerpoint file that already has the master slides the way I want things to look.

I originally thought I could output the text with some sort of magic codes that Powerpoint would recognize and parse into the right places. For example, I was imagining something like this (total random idea, just to help you understand what I mean):
Code:
  [new slide]
  [title]
  My Title
  [text]
  Text line 1
  Text line 2
  [new slide]...

I can't (easily) make binary data (like a real ppt file), but it's no problem to make my PHP code pad the text with any assortment of ascii, including control characters. But it doesn't look like there is a way to do it all on the front end (in other words, without special code on the Powerpoint end). The help file claims that it will take an RTF file (formatted as MS Word would make it), and put Heading1 text in a title and any other style text in a standard text block. But it doesn't seem to work - it does the titles but ignores the rest.

So it looks like I might have to learn how to make a VBA Powerpoint macro to take what I give it and bring it into a Powerpoint presentation. I have experience with VBA for Access (custom code for forms and reports), but have never used it in any other Office ap. But if you can point me in the right direction, I have enough programming experience in other languages to figure out the syntax. My only handicap is that I'm working with the Japanese version of Office, so reading the on-line help isn't as easy for me as it would be for you guys who have English systems. [3eyes]

Thanks for any suggestions as to how to proceed.
 
PowerPoint does not require special codes or VBA to do this. It can import text files to slides based on the Outline level.

Slide Title for slide 1
Point number 1
Sub point 1
Sub point 2
Point 2
Slide Title for slide 2
Point 1

... and so on ....

MS Word can send a file to PowerPoint, or PowerPoint can import a file from text.
 
HalfListening wrote: "...or PowerPoint can import a file from text."

I was incredulous that simply starting a line with a tab would tell Powerpoint anything, but before writing back, I decided to try it. Plain text wasn't even included in the default list of file types in the Insert Slides from File dialog, but when I selected *.* and chose my .txt file, it actually did parse it correctly with just tabs!

As far as I can tell, there is nothing in the manual about doing that - it seems to be kinda "underware", if you know what I mean. Thank you, HalfListening, that's way easier than I expected!

Next question: if sometimes I want to designate simple formatting (occasional font size change and underline are the most likely), I know I can't do that with a .txt file, and since I noticed that .html was a standard type in Insert Slides from File, I built a test HTML file with <h1> and <h2> tags that I hoped would signify where to put stuff, and then included some simple font adjustments. It read the HTML fine, but it didn't put anything in the pre-formatted title and text blocks, but made a new plain white text block filling a whole single slide, and put everything in there. Not what I was after. Do you know how I might accomplish this, either with HTML or another format?
 
Sorry, I do not know how to force formatting from text files or how to force the use of title and text placeholders from html.

On the first, I believe that the goal is to help getting the text where it needs to be, allowing you to format at will. I do not think it was intended as a build from system, just a tool.

On the second, PowerPoint has a difficult time determining which item should be the title and which should be text and what else is what, so it imports it all as independent objects.


If this is very important to you, then write a simple VBA macro in PowerPoint to go through all the slides checking for &quot;special&quot; text you insert for formatting. Then, according to the special text content, apply the formatting from code. Unless you have a large number of presentations to put together this way, it would probably be faster to just manually format in PowerPoint.
 
It's not so much the quantity of the presentations, as the repeatability - I will be pulling content from this database over and over to construct presentations (if it helps you understand, the content is song lyrics and the application is preparing a selection of several for weekly worship in a church, and some songs need some formatting to fit on the slide or be understandable for singing). The database doesn't exist yet - I'm thinking of creating it because the current method of finding songs in a master Powerpoint file is getting difficult as the number of songs grows (and there are often 2-4 slides per song, and most songs are sung in two languages, as this is a bilingual worship service). Also, with a database one could query for songs by theme, tempo, key, etc., to help with the selection process. But as I get time to develop the database and frontend for it, I'll look at using a macro as you suggested - that sounds like the kind of macro that a first-timer can figure out (everything is within Powerpoint, not trying to get a macro to do the importing, as I was originally worried I would need to do). Thanks again for your help - you got me over the major hump, as I needed to know if the import was possible before I even begin the project.
 
Sounds like you are going about this the hard way. May I suggest a slightly different approach?

1) the database is a good idea. Song title, tempo, key, subject, season, dates the song was done, etc.

2) create individual song ppt files. I try not to re-invent the wheel each time I build a service, so I save any song I have done as a seporate file, in a repository folder. I not only get the formating, but a ready to show group of slides. (I created a 'Save Selection As ...' tool for this very reason: see )

3) Use a link from the database to the repository folder to snag the song's ppt file instead of re-building it each time.
 
You talk as if you are also a worship leader! I looked for other personal clues on your web site, but all I discovered was your love for cats and for the country I live in (and your daughter is apparently from) - Japan. Note my handle. [wink] Hey, your cat may not like mochi, but I do - mmmm! [tongue] BTW, great web site - I don't mind that you don't have a bunch of wizbang graphics slowing it down - it's a site of information, so the information is what counts. (When I designed mine, I felt the need for a little more estethic appeal for my target audience, but I tried to keep it fast-loading. Check out if you're curious about me.)

Anyway, back to the topic at hand. Your idea does sound pretty clean, and your add-in would certainly speed up the process of making the directory of songfiles. But is it true that even if a well-built DB front end allows me to select a set of multiple songs, I would need to open each song file one by one and copy the contents into the file I'm building for a given service? That would still be better than what I'm doing now, but if I go through the work of writing the DB front end, I was hoping to automate as much of the process as possible. Maybe it's still the best answer, but I'm exploring the possibilities.
 
Sorry, slight misunderstanding. The web space to put that add-in on-line was furnished by an amazing individual named Steve. While I also love cats, I live in the state next to his.

Yes, I do the tech stuff for our church, but dislike being in front of a crowd. I prefer not to be a worship leader, more of a worship helper.

If your worship follows roughly the same pattern from week to week, you can place a small VBA macro that would allow you to select the songs from pull down lists at the beginning of the PPT file. The macro would then populate the main worship PPT file from the smaller saved song PPT files. If we do not do any new songs/hymns, I can build a service's main (music, responsive readings, etc.) PPT in less than 5 minutes.
 
That makes three of us cat-lovers. And I am also like you in that I prefer a supporting role in worship, but at the moment there is no one else to take the lead.

Your method sounds pretty nice, and fits my situation quite well. Although it wouldn't give me theme/key/tempo search or record frequency of use, it would save me a BUNCH of time of writing a DB application and would still accomplish my #1 objective, which is seeing the song choices at a glance and selecting from them without sifting through a presentation file with an average of 6 slides per song (3 slides in each language). And it's a solution that keeps the discussion on-topic for this forum... [wink]

As I said in my first post, although I have done some VBA for Access (heavily relying on the Access 2000 Developer's Handbook, since the on-line help is in Japanese, which is not my best language!), I have never written a macro. Today I decided to dive in and get started. Most of my learning came from looking through the popup list of methods for an object, choosing a likely-sounding one, and then using F1 to see whether I can figure out how to use it. Not terrificly efficient, but I think I have a start. Without any variables passed in (I don't know how to do that with a macro yet), I have the following experimental, static code:

Code:
Sub SelectSong()
Set myWindow = ActiveWindow
Presentations.Open &quot;S:\OIC\Saturday Night Worship\OIC Saturday Songs.ppt&quot;, msoTrue
Presentations(&quot;OIC Saturday Songs&quot;).Slides.Range(Array(132, 133, 134, 135, 136, 137)).Copy
myWindow.Activate
ActivePresentation.Slides.Paste
End Sub

Frankly, I was pleased to get this far without guidance in English. But there are some mysteries even regarding this static sample. First, it just pastes the new stuff at the end of the file rather than at the cursor point, and I can't find an example in the help file of a dynamic location for the paste. Second, until I find something like an IsOpen property for something other than an HTML Object Item (whatever that is - that's the only instance of IsOpen I could find in the help), the macro will keep opening new copies of the master file (or I'll have to close it at the end of the macro - seems silly when I'm going to open it again the next time through). Third, ultimately slide numbers are not the safest way to reference the songs, because if for example I add a verse to one that's not at the end, all the numbers will change. Is there a label or bookmark function of some sort that I could insert at the beginning and end of each song in the master file and then reference in my macro?

Then I'll have to figure out how to make the pulldown lists you mentioned to select the song I want and pass the appropriate variables to the macro...I looked for likely items on the Insert menu, but found nothing, and I don't know what that's called in Japanese in order to search the help file. Or do you construct that with code also? If so, I wonder if it can automatically build itself from tags/bookmarks/whatever in the master file, so that one doesn't have to add a new song in two places and make sure they're in sync?

I learn best by code examples - if you don't mind sharing some or all of what you use to select and copy slides from a master song presentation file to the week's service presentation, I could learn from it and modify it for my needs. Otherwise, handicapped by language, I might be in danger of annoying this forum by asking too many questions that are answered in the on-line help. [ponder]

Or does anyone know how I can get the help files (both for Powerpoint and Visual Basic) in English? That would be a big help. I managed to do that for some complex Adobe applications that I use, and it really sped things up.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top