Link to home
Start Free TrialLog in
Avatar of Pufin
Pufin

asked on

Changing text in Powerpoint using vba

Hello Experts,

I have a Powerpoint 2003 presentation with English text but I would like to add some sort of macro/vba that will automatically change the text to another language. (I have 3 or 4 languages to consider)

The presentation contains text and pictures, only the text is to change.

I intend to store the text or phrases in an excel table for example.
I can store the text as a "text block" in 1 excel row for each slide (use the columns for each language), but I am unsure how the bullet marks in the text box will react to this

thanks.
 
Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

>>> but I am unsure how the bullet marks in the text box will react to this

Can you clarify, there is no reason, (in my limited experience) that the text cannot be simply replaced as long as we have a mechanism to link the existing text.

Either a stored record indicatinhg the 'current language to support replacements or a record of the structures, Text boxes etc and a dynamic population of them from an excel sheet.

Of the two the first is probably easiest with the second being more flexible but potentially a lot of work to develop.

If you want to proceed in this way then a sample would be useful to see the constructs used.

Chris
Avatar of Pufin
Pufin

ASKER

Thanks - the bullets comment is not so important.
I am a little vague - since I have just started this topic and am usure which way to proceed

The files I am using are nothing complexed - although it might get more advanved latter. The powerpoint slides are just standard slides with a title, a text box and a picture object. I was just thinking of say 3 buttons on the first slide to be clicked - this then causes the other slides to be populated with one of the 3 languages. The excel file is also a simple single table.

I need some way to identfy each slide and each correponding text box and tilte box (is this just a text box) so I know which text to relplace it with (I think).

rgs.

>>> I need some way to identfy each slide and each correponding text box and tilte box (is this just a text box) so I know which text to relplace it with (I think).

Each slide has an id that can be used either the slide order or a slide identity so the identify slide will work.

Each textbox etc.  They are somewhat uncontrolled  can all be named and can all have one or more identifying marks so again that is viable.

The essence is therefore a list i.e. excel of the titles and text associated with each where the text can be indexed to a language column.

It might be a lot more than 1 question though so how to proceed and how much you are capable of yourself is the issue.

Chris
Avatar of Pufin

ASKER

OK - thanks -

can you show me how to identify the ID for each slide or the ID for each object on the slides so I can make a list, then use this info to populate an excel table. I will then fill the text (3 languages) into the excel and the re populate the slide to the corresponding ID number.
Can one re name the textboxes in to a more logical sequence.

I think I can do the bit to transfer text from excel and back to the slide (if not then this will be a new question) - it is the box identinfication I have a problem with.

I noted the when I add a new text box - its indicator - eg "rectangle 3" is very unpredicable. the next text box was called  "rectangle 14" (os near to this) - I am unsure of the item number and ID, perhaps it is best to use slide index - just in case I add more text boxes to slide and refer to each as - eg Slide1Box1, Slide1Box2, Slide2Box1 Slide2Box2 Slide2Box3  etc.
rgs,
I'm trying to put together a sample which may not answer everything but perhaps enough to set you off.

Chris
As an example to help you ebvaluate a way forward, the following SS does a simple generation of an automated PPT file, (NO SAVE) according to the actual language selected in A2.  Complexity will escalate when trying to support different constructs.

I will now try and evaluate a way of editing an existing PPT and advise how it looks.

Chris
Now with added file!
xltoNewPPT.xls
Avatar of Pufin

ASKER

Having problem with the line near the end

sld.Shapes(ThisWorkbook.Worksheets("Sheet2").Range("e" & rw).Text).TextFrame.TextRange.Text

object does not exist ?

rgs,
Avatar of Pufin

ASKER

ahh

The first title box is called "Rectangle 2" thus the confusion. I need to sort out this hap-hazard namining of shapes somehow.

Unsurprisingly I tested before posting so can you say what you might have changed?

Chris
Probably a version difference BUT easily resolved and at least this way because the document is generated on the fly there would never be an issue.

Conceptually if the principle works for you then you can expand the concept and extend the capabilities with a new question if necessary ... and I would expect this to be so over time.

Chris
ASKER CERTIFIED SOLUTION
Avatar of Chris Bottomley
Chris Bottomley
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pufin

ASKER

Yes it functioned now. As you mentioned I need to work on it a little more - I have more basic ideas and concepts on how to move forward and that was my main aim.
Thanks for your help.
Any reasonable challenge is welcome and this an area that intrigues me so thank you for the bite sized problem.

Chris