Convert Word documents to PowerPoint

Gabriel
NewLounger
Posts: 11
Joined: 13 Feb 2013, 21:50

Convert Word documents to PowerPoint

Post by Gabriel »

This is a new request for help.
I have ~1000 word files containing hymns text and I need to create PPT for each file with the following:
Slide #1: contains text starting from the beginning of the file until the macro finds double blank lines
Slide # 2: starts after the double blank lines until the macro finds the next double blank lines and so on until the end of the text
If the macro finds the word "Chorus", then the slide for the chorus will be repeated after each verse.

Also I need the option of selecting:
1) Slide background
2) Font type and size
3) Font color
4) Text will be centered in the slide
4) PPT file will be saved using the same name of the word file

Is it possible for the same macro to create an index containing name of the slide [or first line of the first verse] and first line of the chorus, or this might be in a separate macro?

Thank you so much for your great help.

User avatar
HansV
Administrator
Posts: 78405
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert Word documents to PowerPoint

Post by HansV »

Welcome to Eileen's Lounge!

I have moved your post to a new thread since it was not directly related to the one in which you posted it.

Could you attach a small sample Word document to a reply? That will make it easier to work on a macro.
Best wishes,
Hans

Gabriel
NewLounger
Posts: 11
Joined: 13 Feb 2013, 21:50

Re: Convert Word documents to PowerPoint

Post by Gabriel »

Hi Hans,
Thank you for your prompt reply. Below is a sample of the word doc file to be converted to PowerPoint. I have saved a PPT file as an example of the expected outcome of the macro. How can I upload it or send it to you? thanks again for your help

Verse 1
O Lord my God
When I in awesome wonder
Consider all the worlds
Thy hands have made
I see the stars
I hear the rolling thunder
Thy power throughout the
universe displayed


Chorus
Then sings my soul
My Savior God to Thee
How great Thou art
How great Thou art


Verse 2
When through the woods
And forest glades I wander
And hear the birds sing
sweetly in the trees
When I look down
From lofty mountain grandeur
And see the brook
and feel the gentle breeze


Verse 3
And when I think
That God His Son not sparing
Sent Him to die I
scarce can take it in
That on the Cross
My burden gladly bearing
He bled and died
to take away my sin


Verse 4
When Christ shall come
With shouts of Acclamation
And take me home
What joy shall fill my heart
Then I shall bow
In humble adoration
And then proclaim
"My God, how great Thou art!”

User avatar
HansV
Administrator
Posts: 78405
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert Word documents to PowerPoint

Post by HansV »

You can attach a .ppt or .pptx file to a reply if it is less than 250 KB in size. If it is larger, zip the presentation and attach the zip file.
See Tip: adding an attachment using the prosilver skin for instructions if you need them.
Best wishes,
Hans

Gabriel
NewLounger
Posts: 11
Joined: 13 Feb 2013, 21:50

Re: Convert Word documents to PowerPoint

Post by Gabriel »

Hi Hans,
Please find attached the PowerPoint file as an example of the expected outcome of the macro.
Thank you,
Gabriel
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78405
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert Word documents to PowerPoint

Post by HansV »

OK, thanks.

My first impression is that it's doable, but not easy (PowerPoint VBA is the weirdest of all VBA dialects in my opinion), and it's well past midnight here, so I won't have a solution immediately.
Best wishes,
Hans

Gabriel
NewLounger
Posts: 11
Joined: 13 Feb 2013, 21:50

Re: Convert Word documents to PowerPoint

Post by Gabriel »

Much appreciated. Good night. Gabriel

User avatar
HansV
Administrator
Posts: 78405
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert Word documents to PowerPoint

Post by HansV »

In the attached zip file, you will find two PowerPoint presentations:
Convert.zip
ConvertWord.pptm is an empty presentation containing the macro.
OneSlide.pptx is a "template" presentation with the desired formatting. If you want to change the formatting of the presentations created by the macro, edit the master slide of OneSlide.pptx.
Unzip both presentations to the same folder (it doesn't matter which folder, but it's best if you make this folder a Trusted Location for PowerPoint).

Place one or more of the Word documents with hymns in a folder - I'd start with just two or three documents.
Open ConvertWord.pptm.
Enable macros if you're prompted to do so.
Click the little button with a cloud symbol on the Quick Access Toolbar:
x1427.png
Select the folder in which you stored the Word documents, then click OK.
If all goes well, you should see this:
x1428.png
The PowerPoint presentations will have been saved to the folder that contains the Word documents.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

Gabriel
NewLounger
Posts: 11
Joined: 13 Feb 2013, 21:50

Re: Convert Word documents to PowerPoint

Post by Gabriel »

Dear Hans,
The macro works perfectly. Everything went smoothly without a problem. Thank you so much for your great help.

Is it possible to create an index for the hymns after each time we run new files? Ideally the index contains the first line of the first verse + the first line of the chorus. So we can search by either the first line of the first verse or search by the first line of the chorus. Index content will be hyperlinked [i.e. click on the name in the index to go to the PPT].

Can the macro recognize other languages? The reason for that: at our church we have a service that runs in "Arabic Language" and they have huge number of hymns that needs to be converted from word into ppt. Is this possible?

Your help is much appreciated. God bless.

Gabriel

User avatar
HansV
Administrator
Posts: 78405
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert Word documents to PowerPoint

Post by HansV »

In what form would you like the index?
- A Word document
- A HTML page
- Something else (if so, what?)

It wouldn't be difficult to modify the macro for other languages that use the Latin (western) alphabet, such as Spanish, German or French.
I don't know how to modify it for languages using other scripts, such as Arabic, Chinese or Japanese.
Best wishes,
Hans

Gabriel
NewLounger
Posts: 11
Joined: 13 Feb 2013, 21:50

Re: Convert Word documents to PowerPoint

Post by Gabriel »

The index would be better if it is in Excel file named "HymnsIndex"..
Thanks again for your great help.
Gabriel

User avatar
HansV
Administrator
Posts: 78405
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert Word documents to PowerPoint

Post by HansV »

Here is a new version of the ConvertWord.pptm presentation. Unzip it to the folder containing the previous version (it is OK to overwrite it).
ConvertWord.zip
It will ask you what the names of 'Verse' and 'Chorus' are. For English, just press Enter. For other languages, enter the appropriate names, e.g. Strophe and Refrain for German.

In addition to the PowerPoint presentations, it will create or expand a hyperlinked index in an Excel workbook in the same folder as ConvertWord.pptm.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

Gabriel
NewLounger
Posts: 11
Joined: 13 Feb 2013, 21:50

Re: Convert Word documents to PowerPoint

Post by Gabriel »

Hi Hans,
The new macro did not work. It gives the following error [attached].
Regards,
Gabriel
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78405
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert Word documents to PowerPoint

Post by HansV »

Could you try the following version?
ConvertWord_debug.zip
When the error occurs, you'll get a dialog with buttons End, Debug and Help.
Please click Debug.
This will activate the Visual Basic Editor, with the line that causes the error highlighted in yellow.
Please copy the highlighted line and paste it into a reply.
After that, you can click the Reset (Stop) button on the toolbar.
x1429.png
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

Gabriel
NewLounger
Posts: 11
Joined: 13 Feb 2013, 21:50

Re: Convert Word documents to PowerPoint

Post by Gabriel »

Hi Hans,
It did not run and gave the same error message for both the English and the Arabic text. The English and The Arabic word files were copied and run in 2 separate folders. In the Arabic case, the program asked for input for verse and chorus, and when it was typed in Arabic, it came as strange letters [un-recognizable]. and then gave the error message.

The last thing [hopefully] is that:
some of the hymns does not have verses or chorus. i tried to run an example [attached in word and ppt] but the outcome was not as neat as the first run.
This is not urgent. I feel guilty of taking too much of your time. Please do it when you have time.

Please find attached 2 word files run by the First macro and the outcome in PPT. Please check the NewHymn ppt.

I also attached the same 2 word files but when run by the last macro [+ the Excel file]. Please note that the original word file [O Lord my God.docx] was not converted into PPT using the Last Macro.

Final I attached the error came when I ran the last macro [debug].

Thanks again for all your great help.
Gabriel
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78405
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert Word documents to PowerPoint

Post by HansV »

As I mentioned before, the macro won't handle Arabic. VBA doesn't handle Arabic text well, I suspect.

From your initial sample, I had assumed that each strophe would either begin with "Verse n" (n = 1, 2, 3, ...) or with "Chorus".
The NewHymn example doesn't have those. I'll see tomorrow if I can do something about that.

Furthermore, most lines have a paragraph break at the end, but the last strophe in NewHymn has some manual line breaks. My code only looks for paragraph breaks. This causes the error you got.
x1430.png
Please change the manual line breaks to paragraph breaks. You can do this using the Replace dialog (Ctrl+H) in Word: enter ^l (^ followed by lower case L) in the Find what box, and ^p (^ followed by lower case P) in the Replace with box, then click Replace All.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

Gabriel
NewLounger
Posts: 11
Joined: 13 Feb 2013, 21:50

Re: Convert Word documents to PowerPoint

Post by Gabriel »

I changed the manual breaks with the paragraph breaks and both ran fine. Also the index is perfect where the verse part is in one column and the chorus part in another column.
Thank you again.
Gabriel

User avatar
HansV
Administrator
Posts: 78405
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert Word documents to PowerPoint

Post by HansV »

Here is a version that will also handle hymns that don't have "Verse 1" etc. in the first line of each verse.
ConvertWord.zip
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

Gabriel
NewLounger
Posts: 11
Joined: 13 Feb 2013, 21:50

Re: Convert Word documents to PowerPoint

Post by Gabriel »

Dear Hans,
Everything was perfect including the index.
One minor issue which is the second slide [ie the first chorus slide]. Please see attached pptx.
Thank you again for all your great help and support.
Your work is much appreciated.
GBU.
Gabriel
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78405
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert Word documents to PowerPoint

Post by HansV »

Sorry, I had forgotten one line of code. Hopefully it is correct now.
ConvertWord.zip
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans